MySQL¶àÏß³Ìͬ²½MySQL-Transfer½éÉÜ
ÔÎĵØÖ·£ºhttp://dinglin.iteye.com/blog/1581877
Ò»¡¢¹ØÓÚTransfer
MySQL-Transefer£¨Ï³ÆTransfer£©ÊÇÒ»¸ö»ùÓÚMySQL+patchºóµÃµ½µÄÖ÷´Óͬ²½¹¤¾ß¡£
ÆäÖ÷ҪĿµÄÊÇΪÁ˽â¾öÔÉú°æ±¾µÄÖ÷´Óͬ²½À´Ó¿âÊǵ¥Ïß³ÌapplyÖ÷¿âµÄbinlog£¬µ¼ÖµÄÑÓ³Ù¡£
×î½üÍê³É²âÊԵİ汾½«multi-master (by P.Linux)ºÏ²¢µ½TransferÖв¢Õë¶ÔÖ§¸¶±¦µÄÓ¦ÓÃÐèÇó×öÁ˶¨ÖÆÐÔÄܸĽø¡£
ÕâÀï×öÒ»¸öÒѾÍê³ÉµÄÍêÕû¹¦ÄܽéÉÜ¡£
¶þ¡¢×ÜÌå½á¹¹
˵Ã÷£º
1¡¢Transfer¿ÉÒÔ×¢²á³É¶à¸öMasterµÄ´Ó¿â
2¡¢Transfer½ÓÊÕ¶à¸öMaster´«ÈëµÄbinlogºó½«¸üÐÂÖ´Ðе½SlaveÉÏ
3¡¢Transfer±¾µØûÓÐÊý¾Ý
Èç¹ûÄãûÓжàÖ÷µÄÐèÇó£¬Äǽṹ¾ÍÊÇMaster -> Transfer -> Slave.
Èý¡¢ÄÚ²¿½á¹¹
¼ÈÈ»Êǵ¥Ïß³ÌÔì³ÉµÄÖ÷´ÓÑÓ³Ù£¬ÌáÉý¾ÍÐèÒªÓöàÏß³ÌÀ´ÊµÏÖ¡£
ÎÒÃÇÀ´¿´µ¥Ö÷Çé¿öϵÄÄÚ²¿ÊµÏÖ¡£
˵Ã÷£º×óÉϽÇÊÇMaster£¬ ÓÒÉϽÇÊÇTransfer£¬ÏÂÃæÊÇSlave¡£
ËÄ¡¢Ôö¼Ó²ÎÊý¼°¶ÔӦ˵Ã÷
ÔÚmy.cnfÖÐÐÂÔöÈçϼ¸¸ö²ÎÊý£º
remote_slave_hostname = Ip of Slave
remote_slave_username =
root
remote_slave_password = root
remote_slave_port = Port of
Slave
stop_slave_on_error = 1
remote_table_maps_file =
./table_maps
transfer_slave_thread = 10
˵Ã÷:
1¡¢ Ç°ËĸöÊÇÄ¿±êslave¿âµÄÈÏÖ¤ÐÅÏ¢
2¡¢ Stop_slave_on_error
Ò»°ã½¨ÒéÅäÖÃΪ1£¬±íʾֻҪÓÐÒ»¸öÏß³ÌÖ´Ðгö´í£¬ËùÓÐslave_io_thread¶¼Í£Ö¹
3¡¢ remote_table_maps_file·¾¶Ö¸Ïò±¾µØÎļþ£¬ÎļþÖÐÿÐиñʽΪ ¡°±í1 ±í2¡±£¬±íʾÔÚTransfer×öͬ²½Ê±£¬½«MasterÉÏËùÓжԱí1µÄ²Ù×÷¶¼¸üе½±í2.
4¡¢ transfer_slave_threadÊÇÒ»¸öÖ»¶Á²ÎÊý£¬¿ØÖÆTransferÓжàÉÙ¸öÏß³Ì×ö²¢·¢¸üУ¨ÈôΪ1Ôò±íʾ´®ÐиüУ¬ÐÔÄÜÓë¹Ù·½°æ±¾Ïàͬ£©¡£Ò»°ã½¨ÒéÅäÖÃΪϵͳºËÊý2±¶¡£
Î塢һЩ˵Ã÷
1¡¢ÓÉÓÚTransferÊÇÔÚMySQL»ù´¡ÉÏ´òµÄpatch£¬Òò´ËÖ§³Ö¼¸ºõËùÓÐMySQLµÄ¼à¿ØÃüÁÄãÔÀ´¼ÓÔÚSlaveÉϵļà¿Ø£¬¿ÉÒÔÖ±½Ó¸Äµ½TransferÉÏ¡£
2¡¢ Ò»°ãÎÒÃǽ«TransferºÍSlave·ÅÔÚͬһ¸ö»úÆ÷ÉÏ£¨µÈÓÚÊÇ×°Á½¸öMySQL£¬Ò»¸öÊÇTransfer£¬Ò»¸öÊÇÕæÕýµÄslave£©
3¡¢ Transfer°´ÕÕ±íÃûhash½«²»Í¬±íµÄ¸üзÖÅäµ½²»Í¬µÄỊ̈߳¬Òò´ËÔÚ¶à±í»·¾³Ï²ÅÄÜ¿´µÃµ½ÐÔÄÜÌáÉý
4¡¢ MasterµÄbinlog¸ñʽ±ØÐëÉèÖóÉrow
5¡¢ ÈôÐèÒªÓõ½¶à¸öMaster£¬¸øÿ¸öMasterÃüÁîÒ»¸öchannel£¬ÃüÁîÐòÁÐΪ change master channel1 to master_log_file=xxx¡¡ ; start slave channel1; ¿ÉÒÔµ¥¶À¶ÔÒ»¸öchanelÖ´ÐÐstart\stopµÈÃüÁî
6¡¢ ÈôÖ»ÐèÒªÒ»¸ömaster£¬ÔòÓï·¨¸ñʽ²»±ä
Áù¡¢ÐÔÄÜЧ¹û
²âÊÔ³¡¾°ÈçÏ£¬ÔÚMasterÉϵÄ16¸ö±í²¢·¢·Ö±ð²åÈë10wÐС£ÆÚ¼äÏÈֹͣͬ²½¡£²åÈëÍê³Éºó£¬ÔÙ·Ö±ð²âÊÔÖ±½ÓÓÃÔÉú°æ±¾Ö÷´ÓºÍTransferµÄÐÔÄÜ¡£
Ö÷¿â²åÈëºÄʱ66.1s ¡£
|
ºÄʱ |
ƽ¾ùtps |
MySQLÖ÷´Ó |
363s |
4402/s |
Transferͬ²½ |
66s |
24242/s |
Æß¡¢PatchÓ¦ÓÃ
ÏÂÔصØÖ·¡£ »ùÓÚ5.1.48, patch ¨Cp0 < transfer_mysql.diff. ºóÐø°²×°²½ÖèÓëÔÉúMySQLÏàͬ.
ʾÀýmy.cnf ´Ó´ËÏÂÔØ£¬¼ÇµÃÐ޸ijÌÐò°²×°Ä¿Â¼¡£
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿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¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ