Supervisor安装教程参考:https://www.cnblogs.com/brad93/p/16639953.html
mysql安装教程参考:https://www.cnblogs.com/brad93/p/16650780.html
监控文件配置:
[program:mysql] ; 管理的子程序名字,要和项目有关联,不能乱写
command=/usr/local/mysql/bin/mysqld_safe –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data/ –plugin-dir=/usr/local/mysql/lib/plugin –user=mysql –log-error=localhost.localdomain.err –open-files-limit=65535 –pid-file=/usr/local/mysql/data/localhost.localdomain.pid –socket=/tmp/mysql.sock –port=3306
directory=/usr/local/mysql
autostart=true
autorestart=true
redirect_stderr=true
priority=8
startsecs=10 ;进程启动后跑了几秒钟,才被认定为成功启动
stdout_logfile =/usr/supervisor/supervisord.d/logs/mysql-superviisor.log ;错误日志输出位置,目录要存在
配置注意事项:
command=/usr/local/mysql/bin/mysqld_safe –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data/ –plugin-dir=/usr/local/mysql/lib/plugin –user=mysql –log-error=localhost.localdomain.err –open-files-limit=65535 –pid-file=/usr/local/mysql/data/localhost.localdomain.pid –socket=/tmp/mysql.sock –port=3306
directory=/usr/local/mysql
这段很长的配置中包含多出路径,其中按照上面教程刚安装mysql,其中的“/usr/local/mysql”就指向安装目录没问题,如果是已经运行mysql比较久了,有过迁库或者配置改过位置,那就看着修改路径的指向,尤其是“–datadir=”“–pid-file=”这两项的路径。
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/287425.html