问题:
当我在一个节点上
create database php_db;
show databases;
这个时候是有php_db的
但是slave stop;
start slave;
flush privileges;
show databases;
这个php_db就没有了
跑到对面节点去了
究竟是哪里出了问题呢?!配置情况如下
节点一(在这个节点执行的创建php_db命令)
mysql> slave stop;
mysql> create database php_db;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| php_db |
| test |
+--------------------+
5 rows in set (0.01 sec)
mysql> start slave;
mysql> flush privileges;
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.18.50
Master_User: master1_1
Master_Port: 1869
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 3634
Relay_Log_File: xiaohe-relay-bin.000019
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: php_db
Replicate_Ignore_DB: mysql
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: 3634
Relay_Log_Space: 674
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
1 row in set (0.00 sec)mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)节点二
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| php_db |
| test |
+--------------------+
5 rows in set (0.00 sec)mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.18.51
Master_User: master1_2
Master_Port: 1869
Connect_Retry: 60
Master_Log_File: mysql-bin.000006
Read_Master_Log_Pos: 3018
Relay_Log_File: hanxin-relay-bin.000015
Relay_Log_Pos: 415
Relay_Master_Log_File: mysql-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: php_db
Replicate_Ignore_DB: mysql
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: 3018
Relay_Log_Space: 718
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: 2
1 row in set (0.00 sec)求高人指点
当我在一个节点上
create database php_db;
show databases;
这个时候是有php_db的
但是slave stop;
start slave;
flush privileges;
show databases;
这个php_db就没有了
跑到对面节点去了
究竟是哪里出了问题呢?!配置情况如下
节点一(在这个节点执行的创建php_db命令)
mysql> slave stop;
mysql> create database php_db;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| php_db |
| test |
+--------------------+
5 rows in set (0.01 sec)
mysql> start slave;
mysql> flush privileges;
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.18.50
Master_User: master1_1
Master_Port: 1869
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 3634
Relay_Log_File: xiaohe-relay-bin.000019
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: php_db
Replicate_Ignore_DB: mysql
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: 3634
Relay_Log_Space: 674
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
1 row in set (0.00 sec)mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)节点二
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| php_db |
| test |
+--------------------+
5 rows in set (0.00 sec)mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.18.51
Master_User: master1_2
Master_Port: 1869
Connect_Retry: 60
Master_Log_File: mysql-bin.000006
Read_Master_Log_Pos: 3018
Relay_Log_File: hanxin-relay-bin.000015
Relay_Log_Pos: 415
Relay_Master_Log_File: mysql-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: php_db
Replicate_Ignore_DB: mysql
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: 3018
Relay_Log_Space: 718
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: 2
1 row in set (0.00 sec)求高人指点
解决方案 »
- 我这个为什么建表不能成功?
- mysql一个比较高深的问题
- MYSQL中可以按照两项或者多项的和降序select吗
- 表缓存如何优化?
- sql存储过程
- 200万条记录的在count与limit时速度很慢,求解决方案
- 使用mysql的API链接时出错,undefined reference to `mysql_init@4'
- 急问mysql:在C程insert into 语句如何定义变量?
- 如何将excel表导入到一个mysql表中?
- Mysql 中如何查询列中汉字的首字母
- mysql_stmt_prepare(),SQL failed Got packets out of order
- mysql从库建触发器与binlog_format=MIXED的问题
server-id=2的节点
[client]
port = 1869
socket = /var/lib/mysql/mysql.sock[mysqld]
port = 1869
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8log-bin=mysql-binbinlog_format=mixed
#binlog-do-db=php_db
#binlog-ignore-db=mysql
log-slave-updates
#replicate-do-db=php_db
#replicate-ignore-db=mysql
binlog-ignore-db = mysql
replicate-ignore-db = mysql
binlog-ignore-db = information_schema
replicate-ignore-db = information_schema
binlog-ignore-db = performance_schema
replicate-ignore-db = performance_schema
binlog-ignore-db = test
replicate-ignore-db = testserver-id = 2[mysqldump]
quick
max_allowed_packet = 16M[mysql]
no-auto-rehash[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M[mysqlhotcopy]
interactive-timeoutinnodb_flush_log_at_trx_commit=1
sync_binlog=1auto_increment_offset=2
auto_increment_increment=2
server-id=1的节点
[client]
port = 1869
socket = /var/lib/mysql/mysql.sock[mysqld]
port = 1869
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8log-bin=mysql-binbinlog_format=mixed
#binlog-do-db=php_db
#binlog-ignore-db=mysql
log-slave-updates
#replicate-do-db=php_db
#replicate-ignore-db=mysql
binlog-ignore-db = mysql
replicate-ignore-db = mysql
binlog-ignore-db = information_schema
replicate-ignore-db = information_schema
binlog-ignore-db = performance_schema
replicate-ignore-db = performance_schema
binlog-ignore-db = test
replicate-ignore-db = testserver-id = 1[mysqldump]
quick
max_allowed_packet = 16M[mysql]
no-auto-rehash[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M[mysqlhotcopy]
interactive-timeoutinnodb_flush_log_at_trx_commit=1
sync_binlog=1auto_increment_offset=1
auto_increment_increment=2
方法是清理掉日志
就可以正常同步了
无论是创建database还是table还是dml操作
都可以