????1??MySQL??replication?????????????????????????????????????????????????????????????????????д????????????????????????????

????2??MySQL??master??slave???????server-id????????£????????????replication?????л???????±???:

????Fatal error: The slave I/O thread stops because master and slavehave equal MySQL server ids; these ids must be different for replication to work(or the --replicate-same-server-id option must be used on slave but this doesnot always make sense; please check the manual before using it).

?????????????????????slave????server-id?????master???????????ɡ?

????3???????????????????slave??????????????????????????replication???????????????????????????????????slave????????copy??????????????????????????м????????relay-log???????centos3-relay-bin.000002???????????У?????????????????????????????????slave?????????????????????????????????????????????????????????????????????slave????????????????????????????????????????????slave??????replication??????????????????????

????4????master??????????????????????????????????????????????????replication slav??replication client?????????????grant?????????????????????????????????????????????????????MySQL???????????????????????????

????5??replication??????????????????????????????????????????????????????????繃??????????????????????????????????????????

???????????????????????????????????????????漲???InnoDB???????????????е???????????????????MyISAM?????InnoDB??????ж???

????1???????????????漰??????????????????OLTP??????У?InnoDB???????????????洢???棻

????2??DRBD?????????????????????????????????????????MyISAM??????п?????????????????????????????????????????????MyISAM???????InnoDB???????

????DRBD+Heartbeat+MySQL?ο??????????????????????????????replication???????????1062???????????????£?

????????ο?MySQL?????????master??????????????????--single-transaction????????????????1062???????????????£?

????Last_SQL_Error: Error 'Duplicate entry 'd36ad91bff36308de540bbd9ae6f4279' for key 'PRIMARY'' on query. Default database: 'mypharma'. Query: 'INSERT INTO `lee_sessions` (`session_id`?? `ip_address`?? `user_agent`?? `last_activity`?? `user_data`) VALUES ('d36ad91bff36308de540bbd9ae6f4279'?? '180.153.201.218'?? 'Mozilla/4.0'?? 1353394206?? '')'

????????????·????--master-data????????master?????????????????????

mysqldump -uroot --quick --flush-logs --master-data=1 -p myproject > myproject.sql

????--master-data???÷??????????????????SQL???????????slave replication????????1???SQL????л???change master?????????2???change master??д??SQL????--master-data????????--single-transaction????????????????lock-all-tables????????????????????????

??????β???SQL?е??LOG_FILE??LOG_POS????????????????????(?????change?????д???д??)???????????

    [root@centos1 ~]# grep "CHANGE " myproject.sql
    CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000008'?? MASTER_LOG_POS=106;