I am trying to setup a master-slave replication. The IP of the master is 10.19.13.36 and for slave is 10.19.13.37. These are the steps I followed to setup.
Set up the following options in my master config file.
bind-address = 0.0.0.0 server-id = 1 log_bin = /var/log/mysql/mysql-bin.log
mysql -u root -p
CREATE USER 'replicauser'@'10.19.13.36' IDENTIFIED BY 'my-secret-password';
GRANT REPLICATION SLAVE ON *.* TO 'replicauser'@'%' IDENTIFIED BY 'my-secret-password';
SHOW MASTER STATUSG
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | | mysql-bin.000010 | 1734 | --- | ---- | demo |
On the slave:
bind-address = 0.0.0.0 server-id = 2 log_bin = /var/log/mysql/mysql-bin.log
mysql -u root -p
CHANGE MASTER TO MASTER_HOST='10.19.13.36',MASTER_USER='replicauser', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000010', MASTER_LOG_POS=1734;
SHOW SLAVE STATUSG;
Slave_IO_State: Waiting for master to send event Master_Host: 10.19.13.36 Master_User: replicauser Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000010 Read_Master_Log_Pos: 1891 Relay_Log_File: MYSQL2-TEST-relay-bin.000003 Relay_Log_Pos: 320 Relay_Master_Log_File: mysql-bin.000010 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: 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: 1891 Relay_Log_Space: 856 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: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: 31e399a8-c79f-11eb-976f-005056990990 Master_Info_File: mysql.slave_master_info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version:
So from the slave status, it seems like the connection is set up successfully yet when I created a test database in my master, it did not show up on the slave.
When I do
show processlist on slave, I get the following:
| Id | User | Host | db | Command | Time | State | Info | | 1 | event_scheduler | localhost | NULL | Daemon | 23001 | Waiting on empty queue | NULL | | 8 | system user| | NULL | Connect | 21423 | Waiting for master to send event | NULL | | 9 | system user | | NULL | Connect | 21423 | Slave has read all relay log; waiting for more updates | NULL |
And when I do
show processlist on master I get this:
| Id | User | Host | db | Command | Time | State | Info | | 1 | event_scheduler | localhost | NULL | Daemon | 24049 | Waiting on empty queue | NULL | | 11 | replicauser | 10.19.13.37:59674 | NULL | Binlog Dump | 21656 | Master has sent all binlog to slave; waiting for more updates | NULL | | 14 | root | localhost | NULL | Query | 0 | starting | show processlist |
But I do not see the database being replicated. I do not see any errors in the log either. I am confused as to what I am doing wrong. Any help would be appreciated.