ITPub博客

首页 > Linux操作系统 > Linux操作系统 > MySQL告警"Connection attributes of length 570 were truncated"

MySQL告警"Connection attributes of length 570 were truncated"

原创 Linux操作系统 作者:张冲andy 时间:2023-09-01 09:16:39 0 删除 编辑

mysql的错误日志中看到如下报错"[Warning] Connection attributes of length 571 were truncated"。比如:

2023-09-01T08:37:49.873924+08:00 9149015 [Warning] [MY-010288] [Server] Connection attributes of length 570 were truncated (76 bytes lost) for connection 9149015, user car_auth_center@172.28.x.x (as car_auth_center), auth: yes
2023-09-01T08:37:51.340721+08:00 2215567 [Warning] [MY-010288] [Server] Connection attributes of length 571 were truncated (77 bytes lost) for connection 2215567, user car_auth_center@172.28.x.x (as car_auth_center), auth: yes

为保存连接属性键值对而保留的每个线程的预分配内存量。如果客户端发送的连接属性数据的聚合大小大于此数量,性能模式将截断属性数据,状态变量Performance_schema_session_connect_attrs_lost 递增 ,并在log_error_verbosity系统变量值大于1时向错误日志中写入一条消息,指示发生了截断。日志消息如下 :“[Warning] Connection attributes of length 571 were truncated”

来看看连接属性长度的设置:

performance_schema_session_connect_attrs_size的默认值在服务器启动时自动调整。该值可能很小,因此如果发生截断(Performance_schema_session_connect_attrs_lost变为非零),您可能希望将performance_schema_session_connect_attrs_size显式设置为一个较大的值。

尽管performance_schema_session_connect_attrs_size的最大允许值是1MB,但实际最大值是64KB,因为服务器对它可以接受的连接属性数据的总大小施加了64KB的限制。如果客户端试图发送超过64KB的属性数据,服务器将拒绝连接。有关更多信息, Section 25.12.9, “Performance Schema Connection Attribute Tables”

告警影响

这个告警可能不会产生什么性能影响,只是提醒连接属性没有被完全捕获。这取决与上下文和具体的用法。这个截断也可能导致数据不完整。

performance_schema库中两个表记录了这些属性的详细信息:1.performance_schema.session_account_connect_attrs:当前会话的连接属性,会该账号关联的其它会话2.performance_schema.session_connect_attrs:所有会话的连接属性

告警处理

要纠正截断警告并确保完全捕获连接属性,请按照以下步骤操作:1.修改配置文件,将参数值调大

# vi /etc/my.cnf
performance_schema_session_connect_attrs_size = 1024

2.保存后重启mysql实例

systemctl restart mysqld

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31383567/viewspace-2979884/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
支持就关注我个人公众号:DBA烂笔头 。专注数据库领域,熟悉oracle、mysql、redis、mongodb,clickhouse等相关技术

注册时间:2016-08-11

  • 博文量
    626
  • 访问量
    286299