my.conf 如下 [mysqld]
character_set_server = utf8mb4
datadir = /var/lib/mysql
expire_logs_days = 1
explicit_defaults_for_timestamp = 1
general_log = ON
general_log_file = /var/log/mysql/general_log_file.log
innodb_buffer_pool_size = 1G
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_flush_neighbors = 0
innodb_io_capacity = 1000
innodb_io_capacity_max = 2000
innodb_large_prefix = 1
innodb_lock_wait_timeout = 30
innodb_print_all_deadlocks = 1
innodb_thread_concurrency = 4
join_buffer_size = 1M
log-error = /var/log/mysql/error.log
log_queries_not_using_indexes = 0
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_timestamps = system
long_query_time = 10
max_connect_errors = 10
pid-file = /var/run/mysqld/mysqld.pid
read_rnd_buffer_size = 8388608
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow_query_log_file.log
socket = /var/run/mysqld/mysqld.sock
sort_buffer_size = 4194304
tmp_table_size = 67108864
wait_timeout = 600
binlog-ignore-db = mysql
enforce-gtid-consistency = ON
gtid-mode = ON
log-bin = mysql-bin
log-slave-updates = ON
innodb_log_file_size = 256M
lower_case_table_names = 1
max_connections = 512
server-id = 1
sql-mode =
STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
1
cmai OP error log 里有频繁的这个信息
2023-03-27T14:25:34.279971+08:00 41869 [Note] Got an error reading communication packets 2023-03-27T14:25:54.280650+08:00 41876 [Note] Got an error reading communication packets 2023-03-27T14:25:54.280710+08:00 41877 [Note] Got an error reading communication packets 2023-03-27T14:26:14.280804+08:00 41881 [Note] Got an error reading communication packets 2023-03-27T14:26:14.280832+08:00 41882 [Note] Got an error reading communication packets 2023-03-27T14:26:34.280017+08:00 41885 [Note] Got an error reading communication packets 2023-03-27T14:26:34.280043+08:00 41886 [Note] Got an error reading communication packets 2023-03-27T14:26:54.280510+08:00 41891 [Note] Got an error reading communication packets 2023-03-27T14:26:54.280538+08:00 41890 [Note] Got an error reading communication packets |
2
cmai OP 使用 k8s 部署的, 内存增长到 limit 上限就重启了
|
3
cmai OP @cmai 以及有大量的 2023-03-27T14:28:59.264149+08:00 41757 [Note] Aborted connection 41757
|
4
jeffrey921 2023-03-27 16:57:22 +08:00
有可能是查询数据后没释放掉
|
5
cmai OP @jeffrey921 有办法验证吗
|
6
sunjiayao 2023-03-27 17:31:19 +08:00
先 show processlist 看看
|
7
liprais 2023-03-27 17:37:46 +08:00
日志挂出来了?
|
8
CharAct3 2023-03-27 18:00:58 +08:00
可以设置一下 maxLifetime ,定期重建连接,触发内存回收,可能对你们的 case 会有帮助
|
9
Cornstalk8256 2023-03-27 18:04:12 +08:00
多大的业务啊,MySQL 居然部署在容器里面
|
11
cmai OP 统一回复,大家不用纠结容器的问题,我们做的是 devops 平台,目的在于一键部署一个 mysql ,并且有统一的指标监控、告警、备份策略以及配置等, 在于开发提效和分离开发人员的关注度
|
13
a7851578 2023-06-21 16:22:04 +08:00
找个实例挂上 valgrind 看看,固定大小不能访问内存,可能是内存泄漏了
|