×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿â¸´ÖÆ

ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿â¸´ÖÆ

ͻ񻣼

ÔÚÏÖ´úµÄ»¥ÁªÍøÓ¦ÓÃÖÐ £¬Êý¾Ý¿âµÄ¸ß¿ÉÓÃÐÔÊǺÜÊÇÖ÷ÒªµÄ £¬ÓÈÆäÊǹØÓÚÔÚÏßÉúÒâÓªÒµ¡¢ÊµÊ±Êý¾ÝÆÊÎöµÈÒªº¦ÓªÒµ³¡¾°À´Ëµ¡£Êý¾Ý¿â¸´ÖÆÊÇʵÏÖÊý¾Ý¿â¸ß¿ÉÓÃÐÔµÄÒ»ÖÖ³£¼û·½·¨¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinux²Ù×÷ϵͳÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿â¸´ÖÆ £¬ÒÔÌá¸ßϵͳµÄ¿ÉÓÃÐÔºÍÈÝ´íÄÜÁ¦¡£

È·±£Êý¾Ý¿âЧÀÍÆ÷ÉèÖÃ׼ȷ

ÔÚ×îÏÈÉèÖÃÊý¾Ý¿â¸´ÖÆ֮ǰ £¬Ê×ÏÈҪȷ±£Êý¾Ý¿âЧÀÍÆ÷µÄÉèÖÃÊÇ׼ȷµÄ¡£Õâ°üÀ¨ÒÔϼ¸¸ö·½Ã棺

²Ù×÷ϵͳ£ºÑ¡ÔñÎȹÌÇÒ¿É¿¿µÄLinux¿¯Ðаæ×÷ΪÊý¾Ý¿âЧÀÍÆ÷µÄ²Ù×÷ϵͳ £¬ÈçCentOS¡¢UbuntuµÈ¡£

ÄÚ´æºÍ´ÅÅÌ£ºÎªÊý¾Ý¿âЧÀÍÆ÷·ÖÅÉ×ã¹»µÄÄÚ´æºÍ´ÅÅÌ¿Õ¼ä £¬È·±£ÏµÍ³¿ÉÒÔ´¦Àí´ó×ڵIJ¢·¢¶Áд²Ù×÷¡£

Êý¾Ý¿âÈí¼þ£ºÑ¡Ôñ¿É¿¿ÇÒ³ÉÊìµÄÊý¾Ý¿âÈí¼þ £¬ÈçMySQL¡¢PostgreSQLµÈ¡£

ÍøÂçÉèÖãºÉèÖÃÍøÂç²ÎÊý £¬È·±£Êý¾Ý¿âЧÀÍÆ÷Äܹ»Õý³£Í¨Ñ¶¡£

×°ÖúÍÉèÖÃÊý¾Ý¿âÈí¼þ

ÔÚLinux²Ù×÷ϵͳÉÏ×°ÖúÍÉèÖÃÊý¾Ý¿âÈí¼þÊǵÚÒ»²½¡£ÒÔÏÂÊÇ×°ÖúÍÉèÖÃMySQLÊý¾Ý¿âÈí¼þµÄʾÀý´úÂ룺

°ì·¨1: ×°ÖÃMySQLÊý¾Ý¿âÈí¼þ

sudo apt-get update
sudo apt-get install mysql-server

µÇ¼ºó¸´ÖÆ

°ì·¨2: ÉèÖÃMySQLÊý¾Ý¿â

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

µÇ¼ºó¸´ÖÆ

ÔÚÉèÖÃÎļþÖÐÕÒµ½ÒÔÏÂÐÐ £¬²¢½«Æä×÷·Ï×¢ÊÍ£º

bind-address            = 127.0.0.1

µÇ¼ºó¸´ÖÆ

ÉúÑÄÉèÖÃÎļþ £¬²¢ÖØÐÂÆô¶¯MySQLЧÀÍ£º

sudo systemctl restart mysql.service

µÇ¼ºó¸´ÖÆ

ÉèÖÃÊý¾Ý¿â¸´ÖÆ

½ÓÏÂÀ´ £¬ÎÒÃǽ«ÉèÖÃÊý¾Ý¿â¸´ÖÆ £¬ÒÔʵÏָ߿ÉÓÃÐÔµÄÊý¾Ý¿â¼Ü¹¹¡£ÒÔÏÂÊÇÉèÖÃMySQLÊý¾Ý¿â¸´ÖƵÄʾÀý´úÂ룺

°ì·¨1: ½¨É踴ÖÆÓû§

ÔÚÖ÷Êý¾Ý¿âÉϽ¨ÉèÒ»¸ö¿ÉÒÔ±»´ÓÊý¾Ý¿â¸´ÖƵÄÓû§£º

CREATE USER 'replication'@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
FLUSH PRIVILEGES;

µÇ¼ºó¸´ÖÆ

°ì·¨2: ±¸·ÝÖ÷Êý¾Ý¿â

ÔÚÖ÷Êý¾Ý¿âÉÏÖ´Ðб¸·Ý²Ù×÷£º

FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;

µÇ¼ºó¸´ÖÆ

¼Í¼ÏÂFileºÍPositionµÄÖµ £¬Õ⽫ÔÚÉèÖôÓÊý¾Ý¿âµÄ¸´ÖÆʱÓõ½¡£

°ì·¨3: ÉèÖôÓÊý¾Ý¿â

ÔÚ´ÓÊý¾Ý¿âÉÏÖ´ÐÐÒÔϲÙ×÷£º

CHANGE MASTER TO MASTER_HOST='Ö÷Êý¾Ý¿âµÄIPµØµã',
MASTER_USER='replication',
MASTER_PASSWORD='password',
MASTER_LOG_FILE='Ö÷Êý¾Ý¿âµÄFileÖµ',
MASTER_LOG_POS=Ö÷Êý¾Ý¿âµÄPositionÖµ;

µÇ¼ºó¸´ÖÆ

°ì·¨4: Æô¶¯´ÓÊý¾Ý¿â¸´ÖÆ

ÔÚ´ÓÊý¾Ý¿âÉÏÆô¶¯¸´ÖƲÙ×÷£º

START SLAVE;

µÇ¼ºó¸´ÖÆ

¼à¿ØºÍά»¤Êý¾Ý¿â¸´ÖÆ

ÔÚÉèÖÃÍêÊý¾Ý¿â¸´ÖÆºó £¬ÎÒÃÇÐèÒª¼à¿ØºÍά»¤¸´ÖƵÄ״̬ £¬È·±£Êý¾ÝµÄÒ»ÖÂÐԺͿÉÓÃÐÔ¡£

°ì·¨1: ¼à¿Ø¸´ÖÆ״̬

ÔÚ´ÓÊý¾Ý¿âÉÏÖ´ÐÐÒÔϲÙ×÷ £¬¿ÉÒÔÉó²é¸´ÖÆ״̬£º

SHOW SLAVE STATUSG;

µÇ¼ºó¸´ÖÆ

°ì·¨2: ´¦Àí¸´Öƹýʧ

ÈôÊǸ´ÖÆÀú³ÌÖзºÆð¹ýʧ £¬¿ÉÒÔʵÑéÒÔϲÙ×÷¾ÙÐÐÐÞ¸´£º

¼ì²éÍøÂçÅþÁ¬ÊÇ·ñÕý³£ £¬È·±£Ö÷´ÓÊý¾Ý¿âÖ®¼ä¿ÉÒÔÏ໥ͨѶ¡£

¼ì²é¸´ÖÆÉèÖÃÊÇ·ñ׼ȷ £¬²¢ÖØÐÂÉèÖø´ÖƲÎÊý¡£

ÈôÊǸ´ÖÆÀú³Ì×èÖ¹ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÖØÐÂÆô¶¯¸´ÖÆ£º

STOP SLAVE;
START SLAVE;

µÇ¼ºó¸´ÖÆ

½áÂÛ£º

Êý¾Ý¿âµÄ¸ß¿ÉÓÃÐÔ¹ØÓÚ»¥ÁªÍøÓ¦ÓÃÀ´ËµºÜÊÇÖ÷Òª¡£Í¨¹ýÉèÖÃÊý¾Ý¿â¸´ÖÆ £¬ÎÒÃÇ¿ÉÒÔÌá¸ßϵͳµÄ¿ÉÓÃÐÔºÍÈÝ´íÄÜÁ¦¡£±¾ÎÄÏÈÈÝÁËÔõÑùÔÚLinux²Ù×÷ϵͳÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿â¸´ÖÆ £¬²¢ÌṩÁËÏà¹ØµÄ´úÂëʾÀý¡£Ï£Íû±¾ÎĶÔÄãÔÚÉèÖÃÊý¾Ý¿â¸´ÖÆʱÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿â¸´ÖƵÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ