Mysql+canal订阅bin-log

1.mysql配置更改:
server-id=2 # 与canal配置的id不重复
log-bin=mysql-bin
binlog-format=ROW #选择row模式

2.expire_logs_day 设置binlog老化日期
mysql> show variables like '%expire%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| expire_logs_days | 0       |
+------------------+-------+
1   row  in   set   (0.00   sec)
mysql>  set   global expire_logs_days=10;
Query OK, 0   rows affected (0.00   sec)
为了使之生效,需要flush logs。

3.给canal服务器分配一个mysql的账号权限,方便canal去订阅binlog日志:
CREATE USER canal IDENTIFIED BY 'canal'; GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%'; FLUSH PRIVILEGES;

4.启动canal监听mysql数据库变化,完成!
(如何启动就不再赘述了,bin下有start脚本执行一下就可以)


****Redis问题****MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.Redis被配置为保存数据库快照,但它目前不能持久化到硬盘。用来修改集合数据的命令不能用。请查看Redis日志的详细错误信息。
报错:
JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
解决:
192.168.2.188:7>config set stop-writes-on-bgsave-error no
"OK"

你可能感兴趣的:(数据库同步)