|
做mysql的数据库同步不成功.请教~~
相关设置 HOST A ip=192.168.0.222
[root@konds root]# cat /etc/my.cnf
[mysqld]
log-bin
server-id=1
binlog-do-db=abc
sql-bin-update-same
#binlog-do-db=kk1
#binlog-ignore-db=mysql
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@konds root]#
mysql>GRANT ALL ON *.* TO test3@'%' IDENTIFIED BY "1234";
mysql> SHOW MASTER STATUS;
+---------------+----------+--------------+------------------+
| File | Position | Binlog_do_db | Binlog_ignore_db |
+---------------+----------+--------------+------------------+
| konds-bin.001 | 79 | abc | |
+---------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql> SHOW SLAVE STATUS\G
Empty set (0.00 sec)
mysql> SHOW PROCESSLIST;
+----+-------+------------------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info
|
+----+-------+------------------+------+---------+------+-------+------------------+
| 1 | test3 | 192.168.0.1:3030 | abc | Sleep | 12 | | NULL
|
| 3 | root | localhost | NULL | Query | 0 | NULL | SHOW PROCESSLIST |
+----+-------+------------------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)
这里为什么是Sleep呢??
mysql> show databases;
+----------+
| Database |
+----------+
| aaa |
| abc |
| mysql |
| test |
+----------+
4 rows in set (0.05 sec)
相关设置host B
ip=192.168.0.253
mysql>GRANT ALL ON *.* TO test3@'%' IDENTIFIED BY "1234";
[root@konds2 root]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
server-id=2
master-host=192.168.0.222
master-user=test3
master-password=1234
master-port=3306
master-connect-retry=60
replicate-do-db=abc
#replicate-ignore-db=mysql
log-slave-updates
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@konds2 root]#
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Master_Host: 192.168.0.222
Master_User: test3
Master_Port: 3306
Connect_retry: 60
Log_File:
Pos: 307
Slave_Running: Yes
Replicate_do_db: abc
Replicate_ignore_db:
Last_errno: 0
Last_error:
Skip_counter: 0
1 row in set (0.00 sec)
mysql> SHOW PROCESSLIST;
+----+-------------+-------------+------+---------+------+-----------------------+------------------+
| Id | User | Host | db | Command | Time | State
| Info |
+----+-------------+-------------+------+---------+------+-----------------------+------------------+
| 1 | system user | none | NULL | Connect | 1955 | Reading master update | NULL |
| 3 | test3 | 192.168.0.1 | abc | Sleep | 30 |
| NULL |
| 4 | root | localhost | abc | Query | 0 | NULL
| SHOW PROCESSLIST |
+----+-------------+-------------+------+---------+------+-----------------------+------------------+
3 rows in set (0.00 sec)
mysql> show master status ;
+------+----------+--------------+------------------+
| File | Position | Binlog_do_db | Binlog_ignore_db |
+------+----------+--------------+------------------+
| NULL | NULL | NULL | NULL |
+------+----------+--------------+------------------+
1 row in set (0.00 sec)
当我向host A的 abc里写动西 host B的abc 不与更新 请帮忙看一下是什么问题 |
|