mysql用supervisor管理_[4]supervisor使用管理:实现对异常中断子进程的自动重启(以mysql为例)...

实现进程服务管理,supervisort监听到进程死后,会自动将它重新拉起,很方便的做到进程自动恢复的功能,不再需要自己写shell脚本来控制安装过程1、到官网下载最新版本,解压编译,tar -zxvf supervisor-3.3.4.tar.gzcd supervisor-3.3.4python setup.py install可能会遇到如下错误:Installed /usr/lib/python2.7/site-packages/supervisor-3.3.4-py2.7.eggProcessing dependencies for supervisor==3.3.4Searching for meld3>=0.6.5Reading https://pypi.python.org/simple/meld3/Download error on https://pypi.python.org/simple/meld3/: [Errno 1] _ssl.c:504: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed -- Some packages may not be found!Couldn't find index page for 'meld3' (maybe misspelled?)Scanning index of all packages (this may take a while)Reading https://pypi.python.org/simple/Download error on https://pypi.python.org/simple/: [Errno 1] _ssl.c:504: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed -- Some packages may not be found!No local packages or download links found for meld3>=0.6.5error: Could not find suitable distribution for Requirement.parse('meld3>=0.6.5')解决办法:tar -xf meld3-1.0.1.tar.gzcd meld3-1.0.1python setup.py install重新执行安装supervisor包生成配置文件echo_supervisord_conf > /etc/supervisord.conf查看配置文件cat /etc/supervisord.conf |grep -v ";"|grep -v "^$"[[email protected] ~]# cat /etc/supervisord.conf |grep -v ";"|grep -v "^$"[unix_http_server][supervisord][rpcinterface:supervisor]supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface[supervisorctl]配置WEB管理进程[inet_http_server]port=127.0.0.1:9001     ; 服务器ipusername=xxx        ;自定义password=xxx        ;自定义创建管理配置文件目录mkdir /etc/supervisord编辑配置文件,在配置文件底部,配置include[include]files=/etc/supervisord/*.conf启动supervisord -c /etc/supervisord.conf

#在

/etc/supervisord目录下添加mysql一个实例的配置文件,如下:

[[email protected] supervisord]# cat mysql_3306.conf

[program:mysql_3306]

#command=/etc/init.d/mysql start --port=3306 --sleep=3 --tryies=3 --daemon

command=/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --datadir=/var/lib/mysql/ --pid-file=/var/lib/mysql/host-172-16-32-152.pid --basedir=/usr/local/mysql --log-error=/var/lib/mysql/mariadb.log --user=mysql

autostart=true

user=mysql

autorestart=unexpected

numprocs=1

redirect_stderr=true

startsecs=10

stdout_logfile=/var/log/block_push.log

stdout_logfile_maxbytes=1MB

stdout_logfile_backups=10

stdout_capture_maxbytes=1MB

stderr_logfile=/var/log/block_push.log

stderr_logfile_maxbytes=1MB

stderr_logfile_backups=10

stderr_capture_maxbytes=1MB

最后执行:

supervisorctl reload

原文:http://blog.51cto.com/sf1314/2131632

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值