Changing the IP Address Configuration of the master server under MySQL master-slave Replication

Source: Internet
Author: User

Generally, the server IP address cannot be changed at will. If the mysql Master/Slave fails to be changed, I will introduce the process of changing the IP address of the master server under MySQL Master/Slave replication.

All the servers of the company are finally placed in the same data center and Intranet access is enabled. In this way, you must change the configuration of several MySQL slave servers.

.

Backup
First, disable the MySQL server (slave) and backup configuration information.

The Code is as follows: Copy code

Service mysqld stop

The Code is as follows: Copy code
# Go To The mysql directory
Cd/var/lib/mysql
# Backup configuration
Cp master.info. bak
# Viewing the number of rows
Wc-l <master.info

Wc is used to ensure that the number of rows in master.info remains the same after modification.

Modify
Then, modify the IP address in master.info to the IP address of the new master server.

Then, start the MySQL server without starting replication.

The Code is as follows: Copy code
Service mysql start -- skip-slave-start

Verify
Log on to MySQL and run SHOW slave status G

If the IP address is the new IP address, congratulations. The modification is successful. Then you can start replication.

The Code is as follows: Copy code

Start slave;
SHOW SLAVE STATUSG

* *************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: xx. xx
Master_User: slave_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.xxxx
Read_Master_Log_Pos: xxxxxxxx
Relay_Log_File: slave-relay-bin.xxxx
Relay_Log_Pos: xxxxxxxx
Relay_Master_Log_File: master-bin.xxxx
Slave_IO_Running: Yes
Slave_ SQL _Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB: mysql, test, information_schema
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: xxxxxxxxx
Relay_Log_Space: xxxxxxxxx
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_ SQL _Errno: 0
Last_ SQL _Error:

Related Article

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.