在VMWare下MySQL有太多连接

时间:2014-03-11 22:24:08

标签: php mysql apache vmware

经过大量的研究和工作后,我很困惑,为什么我的MySQL服务器一直拒绝连接。我已经离开了许多其他人,他们说增加最大连接数,减少wait_timeout,并且现在已经将虚拟机的内存增加到7 GB,在vCenter中保留了1.5 GB的内存。

我在HP Prolaint DL 360 G5上运行此功能,其中包含两个运行vSphere 5.5和vCenter的Intel Xeon E5405和16 GB RAM。 MySQL VM在虚拟机最小安装上运行Ubuntu 12.04,具有:

活动:215 MB 授予:3.65 GB 消耗:1.66 GB 气球:2.88 GB

CPU最大MHz:344 CPU平均MHz:55.561

磁盘使用最大值(KBps):10803 磁盘最高延迟:46 磁盘平均延迟:2

ulimit -n:1024

拒绝连接时的连接数量:16

我有apache与php,两个openfire实例,teamspeak和连接到数据库服务器的rsyslog。我已经检查过,没有人使用持久连接。

知道为什么每隔几天会发生这种情况吗?

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

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /mysql/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 192.168.2.7
#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8

wait_timeout            = 360
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 1000
table_cache            = 2000
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 20M
query_cache_size        = 32M
#
# * InnoDB Configuration - gac64k56
#
innodb_buffer_pool_size = 2G
join_buffer_size = 256K
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer              = 16M

#
# * 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/

0 个答案:

没有答案