在每月访问量为4万的wordpress站点上设置my.cnf和apache.conf

i86rm4rw  于 2021-06-24  发布在  Mysql
关注(0)|答案(0)|浏览(204)

由于我们是这方面的新手,我们很难建立一个wordpress服务器来支持大约20万每月访问的用户。我们有两个盒子(详情如下)。
这里的问题是当用户开始访问服务器时,mysql的cpu将达到149%。这是apache2.conf和mysql.cnf文件的副本。我们的mysql数据库是innodb。有没有关于如何解决的建议?
1apache服务器配置8 gb内存/25 gb磁盘+200 gb/ubuntu 16.04
apache.conf摘录

Timeout 40
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 2

2mysql服务器配置8 gb内存/25 gb磁盘+50 gb/ubuntu 16.04
my.cnf文件

root@mundo-mysql01-c-2-4gib-nyc3-01:/etc/mysql# cat my.cnf

# 

# The MySQL database server configuration file.

# 

# You can copy this to one of:

# - "/etc/mysql/my.cnf" to set global options,

# - "~/.my.cnf" to set user-specific options.

# 

# One can use all long options that the program supports.

# Run program with --help to get a list of available options and with

# --print-defaults to see which it would actually understand and use.

# 

# For explanations see

# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# 

# * IMPORTANT: Additional settings that can override those from this file!

# The files must end with '.cnf', otherwise they'll be ignored.

# 

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
general_log_file        = /var/log/mysql/mysql.log
general_log             = 0

# CACHES AND LIMITS #

open_files_limit               = 65535
table_definition_cache         = 1024
table_open_cache               = 2048

# MyISAM Settings

max_connections         = 300
key_buffer_size         = 256M
myisam_sort_buffer_size = 32M
join_buffer_size        = 1M
read_buffer_size        = 1M
sort_buffer_size        = 16M
thread_cache_size       = 32
wait_timeout            = 300
connect_timeout         = 300
tmp_table_size          = 32M
max_heap_table_size     = 128M
max_allowed_packet      = 128M
max_connect_errors      = 10000
read_rnd_buffer_size    = 1M
bulk_insert_buffer_size = 1M
query_cache_limit       = 4M
query_cache_size        = 128M
query_cache_type        = 1
query_prealloc_size     = 65536
query_alloc_block_size  = 131072
low_priority_updates    = 1
max_write_lock_count    = 1

# * InnoDB

innodb-flush-method            = O_DIRECT
innodb-log-files-in-group      = 2
innodb-log-file-size           = 256M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table          = 1
innodb-buffer-pool-size        = 2048M

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题