我在单独的数据库服务器中配置了MySQL。最初,CPU使用率很高。我在这里粘贴/etc/mysql/my.cnf
详细信息
innodb_buffer_pool_size=4G
innodb_buffer_pool_size = 9G
innodb_buffer_pool_instances=8
innodb_buffer_pool_chunk_size
没有特定配置。因此是128 M
为解决CPU使用率过高的问题,我通过添加/更新一些配置来更新/etc/mysql/my.cnf
文件,然后不再启动服务器
query_cache_limit = 16M
query_cache_type = ON
query_cache_size = 128M
innodb_buffer_pool_size = 9G
max_allowed_packet = 16M
thread_stack = 192K
innodb_log_file_size = 1768M
thread_cache_size = 8
max_heap_table_size = 536870912
innodb_buffer_pool_instances=8
innodb_io_capacity = 1000
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
myisam-recover = BACKUP
max_connections = 1000
在这里,通过参考MySQL文档来添加配置,并且配置和配置也满足以下等式
innodb_buffer_pool_size = n times * (innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances)
你知道我在做什么错吗?
答案 0 :(得分:0)
多少内存?
innodb_buffer_pool_size -- about 70% or RAM if you have more than 4GB of RAM
max_heap_table_size -- 1% of RAM
query_cache_size -- 0 or 50M
innodb_buffer_pool_instances -- 1 per GB of buffer_pool
max_connections -- 100 until you have a clear need for more