mysql 5.0.67
主服務器A:centos5
192.168.234.131
從服務器B:centos5
192.168.234.132
mysql
grant replication slave on *.* to twtcom001@'192.168.234.132' identified by '123456';
主服務器A:centos5
192.168.234.131
從服務器B:centos5
192.168.234.132
mysql
grant replication slave on *.* to twtcom001@'192.168.234.132' identified by '123456';
# iptables -F AB暫時清空,後面再改防火牆
在B服務器登錄A試用賬號(可不用)
# mysql -utwtcom001 -h 192.168.234.131 -p
##################################################################################################################
A:vi /etc/my.cnf
在B服務器登錄A試用賬號(可不用)
# mysql -utwtcom001 -h 192.168.234.131 -p
##################################################################################################################
A:vi /etc/my.cnf
server-id = 1
log-bin
binlog-do-db=test
binlog-do-db=test1
binlog-ignore-db=mysql
log-bin
binlog-do-db=test
binlog-do-db=test1
binlog-ignore-db=mysql
##################################################################################################################
B:vi /etc/my.cnf
B:vi /etc/my.cnf
#server-id = 1
server-id=2
master-host=192.168.234.131
master-user=twtcom001
master-password=123456
master-port=3306
replicate-do-db=test 同步數據庫
replicate-do-db=test1
binlog-ignore-db=mysql 不同步數據庫
server-id=2
master-host=192.168.234.131
master-user=twtcom001
master-password=123456
master-port=3306
replicate-do-db=test 同步數據庫
replicate-do-db=test1
binlog-ignore-db=mysql 不同步數據庫
##################################################################################################################
B上登錄數據庫測試slave是否正常
B上登錄數據庫測試slave是否正常
mysql -uroot -p
mysql> show slave status\G
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.234.131
Master_User: twtcom001
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000013
Read_Master_Log_Pos: 215
Relay_Log_File: localhost-relay-bin.000020
Relay_Log_Pos: 352
Relay_Master_Log_File: mysql-bin.000013
Slave_IO_Running: Yes *
Slave_SQL_Running: Yes * 這裏和上面的都是yes說明正常。
Replicate_Do_DB: test
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: 215
Relay_Log_Space: 352
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
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.234.131
Master_User: twtcom001
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000013
Read_Master_Log_Pos: 215
Relay_Log_File: localhost-relay-bin.000020
Relay_Log_Pos: 352
Relay_Master_Log_File: mysql-bin.000013
Slave_IO_Running: Yes *
Slave_SQL_Running: Yes * 這裏和上面的都是yes說明正常。
Replicate_Do_DB: test
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: 215
Relay_Log_Space: 352
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