add root password to mysql - ACS - Reference Guides

ACS Installation and Administration Guide

Product
ACS
Platform
7.12
Category
Reference Guides
Language
English
Target Audience
public

In this procedure, the reference database is present on Server 1 and Server 2 is not replicating anymore.

To restore Database Master/Slave Synchronization id1 > id2:

On Server 1, run the following command:

mysql>STOP slave;
mysql>SHOW master status;

The following lines are displayed:

+------------------+------------------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+------------------+--------------+------------------+
| $FILENAME | $POSITION | | |
+------------------+------------------+--------------+------------------+

Retrieve $FILENAME and $POSITION.

Run the following command to export Server 1 databases:

mysqldump --all-databases > CKS_01.sql

On Server 2, run the following commands: 

mysql>STOP slave;

Run the following command to import data dumped from Server 1:

mysql < CKS_01.sql

Run the following command to reinitialize replication parameters:

mysql>CHANGE master TO MASTER_HOST='Server1', MASTER_USER='antirepl',
MASTER_PASSWORD='$MASTER_PASSWORD',
MASTER_LOG_POS=$POSITION,
MASTER_LOG_FILE='$FILENAME';

Run the following command to start the replication:

mysql>START slave;

Run the following command to check slave replication:

mysql>show slave status ;

To reset redundant Master to Master replication id2 → id1:

On Server 2, run the following commands:

mysql>RESET master;
mysql>SHOW master status;

The following lines are displayed:

+------------------+------------------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+------------------+--------------+------------------+
| $FILENAME | $POSITION | | |
+------------------+------------------+--------------+------------------+

Retrieve $FILENAME and $POSITION.

On Server 1, run the following commands:

Run the following command to reinitialize replication parameters:

mysql>CHANGE master TO MASTER_HOST='Server2', MASTER_USER='antirepl',
MASTER_PASSWORD='$MASTER_PASSWORD',
MASTER_LOG_POS=$POSITION,
MASTER_LOG_FILE='$FILENAME';

Run the following command to start the replication:

mysql>START slave;

To check synchronization between databases, run a diagnostic on both servers after CKS has been active for a significant length of time.