背景:

mysql所在服务器停服关机,忘记把从库mysql停掉,等主库启动从库报错:
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'

经排查得知两边max_allowed_packet值不一致,slave上的值和配置文件中的值不一致,修改一致后从库就好了,至于为啥不一致了 我也很惆怅

环境:

mysql Ver 14.14 Distrib 5.5.13, for Linux (x86_64) using readline 5.1
CentOS release 6.9 (Final)

操作:

两边统一设置32M/不重启设置方法

Master:

mysql> select @@global.max_allowed_packet/1024/1024 MB;
+-------------+
| MB |
+-------------+
| 16.00000000 |
+-------------+
1 row in set (0.00 sec)

mysql> set @@global.max_allowed_packet=32*1024*1024;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.max_allowed_packet/1024/1024 MB;
+-------------+
| MB |
+-------------+
| 32.00000000 |
+-------------+
1 row in set (0.00 sec)

Slave:
mysql> set @@global.max_allowed_packet=32*1024*1024;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> select @@global.max_allowed_packet/1024/1024 MB;
+-------------+
| MB |
+-------------+
| 32.00000000 |
+-------------+
1 row in set (0.00 sec)

查看salve状态 恢复正常

注:

max_allowed_packet的作用
参考 https://baike.baidu.com/item/max-allowed-packet/2685407?fr=aladdin



如果想赏钱,可以用微信扫描下面的二维码,一来能刺激我写博客的欲望,二来好维护云主机的费用; 另外再次标注博客原地址 itnotebooks.com 感谢!

nginx配置导致WebSocket 响应 500

问题 部署一个实时查看服务器日志的Django项目,完成后 点击调用WebSocket时 报错 Error during WebSocket handshake: Unexpected response code: 500 原因 ...

阅读全文

Terraform操作阿里云ECS,批量创建ECS云主机

利用Terraform实现运维平台的IaaS层,由于公司用的全是阿里云,所以以阿里云为例,不过既然是Terraform,其实无需太在意这个,基类封装好,什么云可以,甚至...

阅读全文

Pyenv+Pyenv-Virtualenv多py版本虚拟环境

当前系统环境 CentOS Linux release 7.5.1804 (Core) #准备安装包 yum -y install readline-devel zlib-devel bzip2-devel sqlite-devel openssl-devel yum ...

阅读全文

欢迎留言