Make sure you have entries for both primary and standby servers in /etc/hosts files in both primary and standby machines.
[root@primaryhostname bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
::1 localhost6.localdomain6 localhost6
10.64.30.8 primaryhostname
10.64.30.9 standbyhostname
[root@standbyhostnamebin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
::1 localhost6.localdomain6 localhost6
10.64.30.8 primaryhostname
10.64.30.9 standbyhostname
Run on primary server:
======================
GRANT ALL PRIVILEGES ON *.* TO root@'primaryhostname' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO root@'standbyhostname' IDENTIFIED BY '';
CREATE USER 'repl'@'primaryhostname' IDENTIFIED BY '';
GRANT REPLICATION SLAVE ON *.* TO 'repl@'standbyhostname' IDENTIFIED BY '';
FLUSH PRIVILEGES;
show master status;
mysql> show master status;
+----------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+----------------+----------+--------------+------------------+
| log-bin.000001 | 98| ManuAppl | mysql |
+----------------+----------+--------------+------------------+
1 row in set (0.00 sec)
(Note down the File and Position)
Run on standby server:
======================
GRANT ALL PRIVILEGES ON *.* TO root@'primaryhostname' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO root@'standbyhostname' IDENTIFIED BY '';
CREATE USER 'repl'@'standbyhostname' IDENTIFIED BY '';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'primaryhostname' IDENTIFIED BY '';
FLUSH PRIVILEGES;
show master status;
(Note down the File and Position)
Run on primary server:
======================
CHANGE MASTER TO MASTER_HOST='standbyhostname', MASTER_PORT=3306, MASTER_USER='repl', MASTER_PASSWORD='', MASTER_LOG_POS=98, MASTER_LOG_FILE=' log-bin.000001';
START SLAVE;
Run on standby server:
======================
CHANGE MASTER TO MASTER_HOST='primaryhostname', MASTER_PORT=3306, MASTER_USER='repl', MASTER_PASSWORD='', MASTER_LOG_POS=98, MASTER_LOG_FILE=' log-bin.000001';
START SLAVE;
[root@primaryhostname bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
::1 localhost6.localdomain6 localhost6
10.64.30.8 primaryhostname
10.64.30.9 standbyhostname
[root@standbyhostnamebin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
::1 localhost6.localdomain6 localhost6
10.64.30.8 primaryhostname
10.64.30.9 standbyhostname
Run on primary server:
======================
GRANT ALL PRIVILEGES ON *.* TO root@'primaryhostname' IDENTIFIED BY '
GRANT ALL PRIVILEGES ON *.* TO root@'standbyhostname' IDENTIFIED BY '
CREATE USER 'repl'@'primaryhostname' IDENTIFIED BY '
GRANT REPLICATION SLAVE ON *.* TO 'repl@'standbyhostname' IDENTIFIED BY '
FLUSH PRIVILEGES;
show master status;
mysql> show master status;
+----------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+----------------+----------+--------------+------------------+
| log-bin.000001 | 98| ManuAppl | mysql |
+----------------+----------+--------------+------------------+
1 row in set (0.00 sec)
(Note down the File and Position)
Run on standby server:
======================
GRANT ALL PRIVILEGES ON *.* TO root@'primaryhostname' IDENTIFIED BY '
GRANT ALL PRIVILEGES ON *.* TO root@'standbyhostname' IDENTIFIED BY '
CREATE USER 'repl'@'standbyhostname' IDENTIFIED BY '
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'primaryhostname' IDENTIFIED BY '
FLUSH PRIVILEGES;
show master status;
(Note down the File and Position)
Run on primary server:
======================
CHANGE MASTER TO MASTER_HOST='standbyhostname', MASTER_PORT=3306, MASTER_USER='repl', MASTER_PASSWORD='
START SLAVE;
Run on standby server:
======================
CHANGE MASTER TO MASTER_HOST='primaryhostname', MASTER_PORT=3306, MASTER_USER='repl', MASTER_PASSWORD='
START SLAVE;
No comments:
Post a Comment