首批通过分布式安全可靠测评,为关键业务系统打造
主备集群架构中,备集群不响应,错误代码 4013
更新时间:2026-05-09 07:56
本文介绍在主备集群架构中备集群不响应报 4013 错误的原因以及解决方法。
影响版本
OceanBase 数据库 V2.2.52 至 V3.x 版本
问题现象
开启一阶段提交优化参数 enable_one_phase_commit 后,备集群不响应。连接备集群失败,如下所示。
obclient -hxxx.xxx.xx.xxx -p2883 -uroot@xxx#xxxx -p
ERROR 2013 (HY000) : Lost Connection to MySQL server at 'reading authorization packet', system error: 0
直连备集群节点,无法执行命令,错误信息如下。
obclient -hxxx.xxx.xx.xxx -p2881 -uroot@xxxx -p
ERROR 4013 (HY000) : No memory or reach tenant memory limit
可能原因
查看日志,发现 CLOG 超限。
[2020-10-27 20:18:20.065353] ERROR [CLOG] update_free_quota (ob_log_file_pool.cpp:394) [9670][2056][Y0-0000000000000000] [lt=12] [dc=0] clog disk is almost full(total_size=1082120392704, free_quota=-173178892288, warn_percent(%)=80, used_percent(%)=96) BACKTRACE:0x867d6ba 0x8625fca 0x46aebe 0x271c4bf 0x6a40831 0x5f104dd 0x728e595 0x69eb762 0x69eb7c8 0x69ec16d 0x50501da 0x85a64a7 0x85a4a03 0x85a3edf查看备集群 3 台主机 CLOG 目录,CLOG 目录已经超限,日志目录水位不下降。
排查日志,发现数据库打印大量 CLOG 无法回收的信息。
[2020-10-27 20:51:58.857351] INFO [CLOG] ob_log_engine.cpp:453 [8193][858][Y0-0000000000000000] [lt=12] [dc=1] cannot recycle because global_max_decided_trans_version(ret=0, file_id=23556, min_file_id=23556)
根据以上信息,推测问题是由于 global_max_decided_trans_version 卡住导致的 CLOG 无法回收。
解决方式
将备集群
clog_disk_usage_limit_percentage参数临时调整到 97%。[admin@hostname ~]$ cd oceanbase/bin/ [admin@hostname bin]$ ./ob_admin -h x.x.x.x -p 2882 set_server_config clog_disk_usage_limit_percentage=97说明
指定的端口号 2882 表示 rpc 端口,用于远程调整集群上所有节点的参数。例如,对于 3 节点集群,在一个节点执行 3 次命令即可。
clog_disk_usage_limit_percentage参数用于设置事务日志的磁盘 I/O 最大使用百分比,默认为 95。有关该参数的详细信息,参见 clog_disk_usage_limit_percentage。将主集群与备集群一阶段提交优化参数
enable_one_phase_commit设置为 False。obclient> ALTER SYSTEM SET enable_one_phase_commit=false;等待 CLOG 回收后,日志目录下降后还原
clog_disk_usage_limit_percentage参数还原至 95%。obclient> ALTER SYSTEM SET clog_disk_usage_limit_percentage=95;
为避免类似问题发生,建议在主备集群上将一阶提交段优化参数 enable_one_phase_commit 设置为 False。