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: |