Change the primary server IP configuration process under MySQL master-slave replication

Source: Internet
Author: User

Company all servers finally put to the same room, opened the intranet access. This way, you have to change the configuration of some MySQL from the server

and become intranet access.

Backup
The first is to shut down the MySQL server (slave end) and backup configuration information

The code is as follows Copy Code

Service Mysqld Stop

The code is as follows Copy Code
#进入到mysql目录
Cd/var/lib/mysql
#备份配置
CP Master.info Master.info.bak
#查看行数
Wc-l < Master.info

WC is to ensure that the number of master.info lines remains the same after modification

Modify
After that, modify the IP address of the Master.info IP to the new primary server.

Then, start the MySQL server without starting the 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 you see the IP as the new address, then congratulations, modify successfully, 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.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.