Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 在Wordpress网站上设置my.cnf和Apache.conf,每月有4万名访问者_Mysql_Wordpress_Apache2_My.cnf - Fatal编程技术网

Mysql 在Wordpress网站上设置my.cnf和Apache.conf,每月有4万名访问者

Mysql 在Wordpress网站上设置my.cnf和Apache.conf,每月有4万名访问者,mysql,wordpress,apache2,my.cnf,Mysql,Wordpress,Apache2,My.cnf,因为我们是这方面的新手,所以我们很难建立一个Wordpress服务器来支持大约20万个每月访问的用户。我们有两个盒子(详情如下) 这里的问题是,当用户开始访问服务器时,MySQL CPU将达到149%。下面是apache2.conf和mysql.cnf文件的副本。我们的MySQL数据库是InnoDB。对如何修复它有什么建议吗 1。Apache服务器 配置 8 GB内存/25 GB磁盘+200 GB/Ubuntu 16.04 apache.conf摘录 Timeout 40 KeepAlive O

因为我们是这方面的新手,所以我们很难建立一个Wordpress服务器来支持大约20万个每月访问的用户。我们有两个盒子(详情如下)

这里的问题是,当用户开始访问服务器时,MySQL CPU将达到149%。下面是apache2.conf和mysql.cnf文件的副本。我们的MySQL数据库是InnoDB。对如何修复它有什么建议吗

1。Apache服务器 配置 8 GB内存/25 GB磁盘+200 GB/Ubuntu 16.04

apache.conf摘录

Timeout 40
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 2
2。MySQL服务器 配置 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

一般来说,您的查询和代码可能编写得很好,而不是经过优化的DHI Igor。。。代码和查询来自Wordpress。。关于my.cnf和apache2.conf的稳定配置有什么建议吗?