网上查看了一下,影响 mysql 的内存的参数主要大概是 innodb_buffer_pool_size key_buffer_size。 现在我把一份线上的配置拷贝到我自己的机器,配置如下
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
innodb_buffer_pool_size = 1024M
datadir = /var/lib/mysql
socket=/var/lib/mysql/mysql.sock
port = 3306
server_id = 11
expire_logs_days = 10
sort_buffer_size = 1M
join_buffer_size = 1M
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
thread_stack = 192K
tmp_table_size = 246M
max_heap_table_size = 246M
key_buffer_size = 300M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
max_connections = 3600
# Disabling symbolic-links is recommended to prevent assorted security risks
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
线上的机器,这份配置启动的时候占了 800M 内存, 而我自己的机器才占用了 214M 内存,
请问有大佬知道这是怎么回事么?