• MySQL告警“Connection attributes of length 570 were truncated“


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

    1. 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
    2. 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.修改配置文件,将参数值调大

    1. # vi /etc/my.cnf
    2. performance_schema_session_connect_attrs_size = 1024

    2.保存后重启mysql实例

    systemctl restart mysqld

  • 相关阅读:
    简单选择排序
    uniapp微信小程序 提示消息 上传文件
    C++核心编程之类和对象---C++面向对象的三大特性--封装
    继苹果、联发科后,传高通下一代5G芯片将由台积电以3纳米代工
    python系列教程214——列表解析与for和if
    TCP/UDP协议
    Android原生插件开发-环境篇
    机器学习训练,没有机器怎么办
    2023.10.10 关于 线程安全 问题
    Matplotlib
  • 原文地址:https://blog.csdn.net/zhang123456456/article/details/132616899