1.·þÎñÆ÷״̬
·þÎñÆ÷A£º192.168.1.1
·þÎñÆ÷B£º192.168.1.2
2.´´½¨Í¬²½Óû§
Ö÷»úÓòA£º192.168.1.2¡¡¡¡Óû§ÃûA£ºsync_a¡¡¡¡ÃÜÂëA£ºaaa
Ö÷»úÓòB£º192.168.1.1¡¡¡¡Óû§ÃûB£ºsync_b¡¡¡¡ÃÜÂëB£ºbbb
ÖÁÉÙ·ÖÅäÒÔÏÂȨÏÞgrant replication slave
3.Ö´ÐÐflush privileges
4.Í£Ö¹MySQL
5.ÅäÖÃmy.cnf(my.ini)
·þÎñÆ÷A | ·þÎñÆ÷B |
user = mysql log-bin = mysql-bin server-id = 1 binlog-do-db = test binlog-ignore-db = mysql replicate-do-db = test replicate-ignore-db = mysql log-slave-updates slave-skip-errors = all sync_binlog = 1 |
user = mysql log-bin = mysql-bin server-id = 2 binlog-do-db = test binlog-ignore-db = mysql replicate-do-db = test replicate-ignore-db = mysql log-slave-updates slave-skip-errors = all sync_binlog = 1 |
server-id±ØÐëΨһ
binlog-do-dbºÍreplicate-do-db±íʾÐèҪͬ²½µÄÊý¾Ý¿â
binlog-ignore-dbºÍreplicate-ignore-db±íʾ²»ÐèҪͬ²½µÄÊý¾Ý¿â
Çë²»Òª¼ÓÈëÒÔÏÂÃüÁ¸ÃÃüÁî²¢²»»á½â¾öuidÌøºÅµÄÎÊÌ⣬ǡǡÏà·´ÒÔÏÂÁ½ÐÐÃüÁî²ÅÊǵ¼ÖÂuidÌøºÅµÄ×ï¿ý»öÊ×
auto_increment_increment = 2
auto_increment_offset = 1
6.ÖØÐÂÆô¶¯MySQL
7.½øÈëMySQL¿ØÖÆ̨
·þÎñÆ÷A£º
show master status \G
flush tables with read lock;
·þÎñÆ÷B£º
show master status \G
flush tables with read lock;
ͬʱ¼Ç¼ÏÂÁ½Ì¨·þÎñÆ÷µÄFileºÍPosition£¬´Ë´¦¼ÙÉ裺
A£º File: mysql-bin.000001
¡¡¡¡Position: 001
B£º File: mysql-bin.000002
¡¡¡¡Position: 002
·þÎñÆ÷A£º
change master to
-> master_host='192.168.1.2',
-> master_user='sync_b',
-> master_password='bbb',
-> master_log_file='mysql-bin.000002',
-> master_log_pos=002;
·þÎñÆ÷B£º
change master to
-> master_host='192.168.1.1',
-> master_user='sync_a',
-> master_password='aaa',
-> master_log_file='mysql-bin.000001',
-> master_log_pos=001;
´Ë´¦ÌîдµÄÊý¾ÝÍêÈ«Ïà·´
8.Ö´ÐÐshow processlist \G²é¿´ÊÇ·ñͬ²½³É¹¦
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ