Step by step configure mysql Replication

Source: Internet
Author: User

Step by step to configure mysql replication adopts the full-Database Replication solution to facilitate management of mysql 5.5 + rhel5.810.4.11.12 master10.4.11.13 slave --- Master side settings 1, create a replication account, mysql> grant replication slave, replication client on *. * TO repl @ '10. 4.11.12 identified by 'mysql; Query OK, 0 rows affected (0.00 sec) 2. Modify the parameter and restart it to take effect. Each server must have a unique server-id. The default value is 1, to prevent conflicts, we recommend that you set it to the last few digits of the IP address. In this example, set it to 12. cnf file implementation # skip-networkingserver-id = 12 # Uncomment the following I F you want to log updateslog-bin = mysql-bin restart mysqlservice mysql restart --- slave end settings 3. slave library parameter settings also need to be restarted to take effect vi/etc/my. cnf # skip-networkingserver-id = 13 # Uncomment the following if you want to log updateslog-bin = mysql-relay-bin 4, if the database uses the MyISAM Table type, you can perform the following operations: shell> mysqldump -- all-databases -- master-data = 1> data. if the database uses the InnoDB table type, use single-transcation: shell> mysqldump -- Ll-databases -- single-transaction -- master-data = 1> data. SQL slave end imports data mysql <data. SQL 5: view the master configuration mysql> show master status; + metric + ---------- + -------------- + ---------------- + | File | Position | Binlog_Do_DB | usage | + usage + ---------- + -------------- + usage + | mysql-bin.000001 | 107 | + usage + -------- + -------------- + -------------- ---- + 1 row in set (0.00 sec) 6. Start replication. The slave end runs the following command -- configure the replication point to change master to MASTER_HOST = '10. 4.11.12 ', MASTER_USER = 'repl', MASTER_PASSWORD = 'mysql', MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 0; -- start copying mysql> start slave; Query OK, 0 rows affected (0.00 sec) 7. Check the replication status. Pay attention to slave_io_state, slave_io_Running, mysql> show slave status \ G *************************** 1. row ********** * **************** Slave_IO_State: Waiting for master to send event Master_Host: 172.16.251.11 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000001 Read_Master_Log_Pos: 1278 Relay_Log_File: linux2-relay-bin.000002 Relay_Log_Pos: 503 Relay_Master_Log_File: mysql-bin.000001 Slave_IO_Running: Yes Slave_ SQL _Running: Yes Replicate_Do_DB :........ 8. Test the replication. Create a new table Slave on the Master to check whether the replication is complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.