|
A:
mysql -V
mysql Ver 12.22 Distrib 4.0.18, for mandrake-linux-gnu (i586)
B:
mysql -V
mysql Ver 12.22 Distrib 4.0.20, for mandrake-linux-gnu (i586)
A: 192.168.1.112
B: 192.168.7.169
A: master
B: slave
A:
/etc/my.cnf
log-bin
server-id = 1
sql-bin-update-same
binlog-do-db=synca
B:
/etc/my.cnf
server-id = 2
master-host = 192.168.1.112
master-user = userab
master-password = apasswd
replicate-do-db = syncb
log-slave-updates
master-connect-retry = 10
B:
mysql -h 192.168.1.112 -u auser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 4.0.18-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use async ;
show tables ;
+------------------------+
| Tables_in_adeptechsync |
+------------------------+
| emp |
A:
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 4.0.18-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show master status ;
+-----------------+----------+--------------+------------------+
| File | Position | Binlog_do_db | Binlog_ignore_db |
+-----------------+----------+--------------+------------------+
| a-bin.014 | 404 | async | |
+-----------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql> show databases ;
+--------------+
| Database |
+--------------+
| database |
async
B:
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 4.0.20-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show slave status ;
| 192.168.1.112 | b | 3306 | 10 | a-bin.014 | 404 | b-relay-bin.031 | 46 | a-bin.014 | Yes | Yes | bsync | | 0 | | 0 | 404 | 46 |
mysql> show databases ;
+--------------+
| Database |
+--------------+
| database |
bsync
NOTE:
A电脑192.168.1.112有async数据库为master,其中有一用户userab的权限可在B登入A用mysql所有权限
B电脑192.168.7.169有bsync数据库为slave,其中有一用户userab有本地所有权限
每一次对A中async有改变的时候,在B上运行
show slave status ;
会发现与A的
show master status ;
中的position是一样的在增变...
A:
less /var/lib/mysql/a.err
60105 21:38:58 mysqld started
060105 21:38:58 InnoDB: Started
/usr/sbin/mysqld: ready for connections.
Version: '4.0.18-log' socket: '/var/lib/mysql/mysql.sock' port: 3306
A:
mysql> show processlist ;
| 45 | userab | b:43118 | NULL | Binlog Dump | 1748 | Has sent all binlog to slave; waiting for binlog to be updated | NULL
B:
060105 23:10:07 mysqld started
060105 23:10:07 InnoDB: Started
060105 23:10:07 Found an entry in the 'db' table with empty database name; Skipped
060105 23:10:07 Slave SQL thread initialized, starting replication in log 'a-bin.015' at position 79, relay log
'./b-relay-bin.032' position: 692
/usr/sbin/mysqld: ready for connections.
Version: '4.0.20-log' socket: '/var/lib/mysql/mysql.sock' port: 3306
060105 23:10:07 Slave I/O thread: connected to master 'userabl@192.168.1.112:3306', replication started in log a-bin.015' at position 79
但是数据没有改变为什么>>>>>>>>>>>
也就是最终没成功,兄弟指点一下下啰.
谢谢 |
|