我在/etc/ mysql /conf.d/myfile.cnf中为mysql使用自定义配置文件。
文件的内容。
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[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
language = /usr/share/mysql/english
skip-external-locking
bind-address = 127.0.0.1
bulk_insert_buffer_size = 8M
connect_timeout=10
interactive_timeout=50
join_buffer=1M
key_buffer=250M
max_allowed_packet=16M
max_connect_errors=10
max_connections=100
max_heap_table_size = 32M
myisam_sort_buffer_size=96M
query_cache_limit = 4M
query_cache_size = 250M
query_cache_type = 1
query_prealloc_size = 65K
query_alloc_block_size = 128K
read_buffer_size=1M
read_rnd_buffer_size=768K
#record_buffer_size=1M
#safe-show-database
#skip-innodb
#skip-locking
skip-networking
sort_buffer=1M
table_cache=4096
thread_cache_size=1024
thread_concurrency=8
tmp_table_size = 32M
wait_timeout=500
# for slow queries, comment when not used
#log-slow-queries=/var/log/mysql-slow.log
#long_query_time=1
#log-queries-not-using-indexes
[mysqld_safe]
nice = -5
open_files_limit = 8192
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M怎么了?
如果对mysql使用默认配置文件,Monit将顺利运行。
我的系统是Debian挤压6.0.x和Mysql Server版本:5.1.66-0+挤压1 (Debian)
错误为monit状态:“状态连接失败”和“端口响应时间连接失败到127.0.0.1:3306 通过TCP默认”
我的配置Monit Mysql
...
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout
...发布于 2021-02-24 20:42:03
在Ubuntu20.04LTS上,我发现pid-file和socket在/etc/mysql/mysql.conf.d/mysqld.cnf中被注释掉了。我取消了这两行的注释,然后用service mysql restart重新启动mysql,用service monit restart重新启动monit,monit成功地监控了mysqld进程。
发布于 2013-03-13 16:12:32
我猜是这条线
if failed host 127.0.0.1 port 3306 then restart如果主机连续命中10 (我认为)坏连接,MySQL将阻塞它。我认为它在第十次检查之前是有效的,然后就开始失效了。其余的没什么不对的。试着像这样修理它
if failed host 127.0.0.1 port 3306 protocol mysql then restart你也应该跑
mysqladmin flush-hosts这将清除被禁止的主机。
https://serverfault.com/questions/487495
复制相似问题