Changes in configuration (mysqld.cnf) file:
For Master:
For Salve:
Both Master and Salve MySQL servers need to restart to make changes effective.
Replication commnads in mysql commnad prompt as root user/super admin
For Master:
For Slave:
Source and Details: here
For Master:
bind-address =0.0.0.0 [to listen all interfaces]
server-id = 1
bind-address =0.0.0.0 [to listen all interfaces]server-id = 2
Both Master and Salve MySQL servers need to restart to make changes effective.
Replication commnads in mysql commnad prompt as root user/super admin
For Master:
-- user creation is optional; an existing user can be granted but
-- need need to be publicly accessible.
mysql > create user 'replication_user'@'%' identified by 'MASTER_PASSWORD';
mysql > GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';
mysql > FLUSH PRIVILEGES;
-- After granting privilege the below command is the mean to collect
-- master info to be used in salve
mysql> show master status;+------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | mysql-bin.000001 | 154 | | | | +------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec)
For Slave:
mysql> stop slave;
mysql> CHANGE MASTER TO MASTER_HOST = '<MASTER_HOST_IP_OR_ADDRESS>',MASTER_USER = 'replication_user', MASTER_PASSWORD = 'MASTER_PASSWORD', MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 154;
mysql > start slave;
** MASTER_LOG_FILE and MASTER_LOG_POS will be according to the values found by " show master status "
No comments :
Post a Comment