×ðÁú¿­Ê±

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

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

ÔÚLinuxϵͳÏ£¬ÉèÖÃÊý¾Ý¿âÖ÷´Ó¸´ÖÆÊÇÒ»Ïî³£¼ûµÄʹÃü¡£Ö÷´Ó¸´ÖÆ¿ÉÒÔÌṩÊý¾ÝÈßÓ౸·Ý¡¢¸ºÔØƽºâºÍ¸ß¿ÉÓÃÐÔµÈÓÅÊÆ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖÃÊý¾Ý¿âÖ÷´Ó¸´ÖƵİ취£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

°ì·¨Ò»£º×°ÖÃÊý¾Ý¿âÈí¼þ

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚÖ÷ЧÀÍÆ÷ºÍ´ÓЧÀÍÆ÷ÉÏ×°ÖÃÏìÓ¦µÄÊý¾Ý¿âÈí¼þ¡£±¾ÎÄÒÔMySQLÊý¾Ý¿âΪÀý£¬×°ÖÃÀú³ÌÈçÏ£º

ÔÚÖ÷ЧÀÍÆ÷ºÍ´ÓЧÀÍÆ÷ÉÏÖ´ÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃMySQLÊý¾Ý¿â£º

sudo apt update
sudo apt install mysql-server

µÇ¼ºó¸´ÖÆ

°ì·¨¶þ£ºÉèÖÃÖ÷ЧÀÍÆ÷

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÔÚÖ÷ЧÀÍÆ÷ÉϾÙÐÐһϵÁÐÉèÖãº

±à¼­MySQLÉèÖÃÎļþ/etc/mysql/mysql.conf.d/mysqld.cnf£¬×÷·ÏÒÔÏÂÐеÄ×¢ÊÍ£¨É¾³ýÐÐÇ°µÄ#£©£º

#bind-address            = 127.0.0.1
#log_bin                  = /var/log/mysql/mysql-bin.log
#binlog_do_db            = mydatabase

µÇ¼ºó¸´ÖÆ

ÖØÆôMySQLЧÀÍÆ÷£º

sudo service mysql restart

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

µÇ¼MySQLЧÀÍÆ÷²¢Ö´ÐÐÒÔÏÂSQLÏÂÁ

mysql -u root -p

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÔÚMySQL½»»¥½çÃæÖÐÖ´ÐУº

CREATE USER 'replication'@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
FLUSH PRIVILEGES;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;

µÇ¼ºó¸´ÖÆ

¼ÇÏÂFileºÍPosition×ֶεÄÖµ£¬ÎÒÃǽ«ÔÚ´ÓЧÀÍÆ÷ÉÏÓõ½¡£

½âËø±í¸ñ£º

UNLOCK TABLES;

µÇ¼ºó¸´ÖÆ

°ì·¨Èý£ºÉèÖôÓЧÀÍÆ÷

½ÓÏÂÀ´£¬ÔÚ´ÓЧÀÍÆ÷ÉϾÙÐÐһϵÁÐÉèÖãº

±à¼­MySQLÉèÖÃÎļþ/etc/mysql/mysql.conf.d/mysqld.cnf£¬×÷·ÏÒÔÏÂÐеÄ×¢ÊÍ£º

#bind-address            = 127.0.0.1

µÇ¼ºó¸´ÖÆ

ÖØÆôMySQLЧÀÍÆ÷£º

sudo service mysql restart

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

µÇ¼MySQLЧÀÍÆ÷²¢Ö´ÐÐÒÔÏÂSQLÏÂÁ£¨½« Ì滻ΪÖ÷ЧÀÍÆ÷µÄIPµØµã£¬ ºÍ Ì滻ΪÉÏÒ»²½ÖмͼϵÄFileºÍPosition×ֶεÄÖµ¡££©

mysql -u root -p

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÔÚMySQL½»»¥½çÃæÖÐÖ´ÐУº

CHANGE MASTER TO MASTER_HOST='<master-ip>', MASTER_USER='replication', MASTER_PASSWORD='password', MASTER_LOG_FILE='<master-file>', MASTER_LOG_POS=<master-position>;
START SLAVE;

µÇ¼ºó¸´ÖÆ

¼ì²é´ÓЧÀÍÆ÷µÄ״̬£º

SHOW SLAVE STATUSG

µÇ¼ºó¸´ÖÆ

È·±£Slave_IO_RunningºÍSlave_SQL_Running×ֶεÄÖµ¶¼ÎªYes£¬ÌåÏÖÖ÷´Ó¸´ÖÆÒѾ­ÀÖ³ÉÉèÖá£

ÖÁ´Ë£¬ÎÒÃÇÒѾ­Íê³ÉÁËÔÚLinuxÉÏÉèÖÃÊý¾Ý¿âÖ÷´Ó¸´ÖƵÄÀú³Ì¡£

×ܽá

±¾ÎÄÏÈÈÝÁËÔÚLinuxϵͳÏÂÉèÖÃÊý¾Ý¿âÖ÷´Ó¸´ÖƵİ취£¬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Í¨¹ýÖ÷´Ó¸´ÖÆ£¬ÎÒÃÇ¿ÉÒÔ»ñµÃÊý¾ÝÈßÓ౸·Ý¡¢¸ºÔØƽºâºÍ¸ß¿ÉÓÃÐÔµÈÀûÒæ¡£ÉèÖÃÖ÷´Ó¸´ÖÆʱÐèҪעÖØÖ÷ЧÀÍÆ÷ºÍ´ÓЧÀÍÆ÷µÄÈí¼þ×°ÖúÍÉèÖã¬ÒÔ¼°×¼È·ÉèÖÃÖ÷´ÓЧÀÍÆ÷µÄÅþÁ¬ºÍȨÏÞ¡£Ï£Íû±¾ÎĶÔÄãÔÚLinuxϵͳÉÏÉèÖÃÊý¾Ý¿âÖ÷´Ó¸´ÖÆÓÐËù×ÊÖú¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿