mysql主从 主库Position不增加

lly0911 2018-07-10 02:31:15
请教各位大佬,搭建了一套mysql主从,主库中建表,插入数据,主库中Position不增长,导致从库也同步不过去,这是什么情况?忘各位大佬不吝赐教!


mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000005
Position: 590
Binlog_Do_DB: btbzb_zmhk,test
Binlog_Ignore_DB: mysql,information_schema,performance_schema
Executed_Gtid_Set:
1 row in set (0.00 sec)

mysql>
mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.06 sec)

mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.04 sec)

mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.09 sec)

mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.02 sec)

mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.03 sec)

mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000005
Position: 590
Binlog_Do_DB: btbzb_zmhk,test
Binlog_Ignore_DB: mysql,information_schema,performance_schema
Executed_Gtid_Set:
1 row in set (0.00 sec)

mysql>
...全文
507 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjcxc 2018-07-11
  • 打赏
  • 举报
回复
那估计是你配置得有问题
这个参数决定那些库要记录 binlog,如果配置错了,那没有配置上的库自然是不记录 binlog 的
如果 所有库都要同步,那通常不设置这个,默认是所有库都要记录的(有需要可以考虑通过设置 Binlog_Ignore_DB 把系统库过滤掉)
一般做主备就不做设置,这样系统库的也过去,这样保持两边完全一样,主库挂了就直接高性用从库就行
lly0911 2018-07-11
  • 打赏
  • 举报
回复
引用 4 楼 zjcxc 的回复:
主库不加,是你没开 log_bin 吧,看看这个查询的结果是什么
show variables like '%log_bin';
主库肯定开了的,昨天后来把 binlog-do-db这个参数注释掉,重要增加了,然而不明白为什么会这样

mysql> show variables like '%log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin | ON |
| sql_log_bin | ON |
+---------------+-------+
2 rows in set (0.01 sec)
zjcxc 2018-07-11
  • 打赏
  • 举报
回复
主库不加,是你没开 log_bin 吧,看看这个查询的结果是什么
show variables like '%log_bin';
lly0911 2018-07-10
  • 打赏
  • 举报
回复
引用 2 楼 qq_37496900 的回复:
Replicate_Do_DB:
Replicate_Wild_Do_Table:
为空,改下配置文件,设置库

主库的配置以及改了,从库这个参数应该还需要加吗?

o前男友o 2018-07-10
  • 打赏
  • 举报
回复
Replicate_Do_DB:
Replicate_Wild_Do_Table:
为空,改下配置文件,设置库
lly0911 2018-07-10
  • 打赏
  • 举报
回复
从库状态正常,如下
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.16.144
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 590
Relay_Log_File: relay-log-bin.000002
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000005
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: 590
Relay_Log_Space: 525
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: 144
Master_UUID: 03756dc9-83fe-11e8-8572-107b44f32217
Master_Info_File: /www/server/data/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:
1 row in set (0.00 sec)

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧