supervisord监控服务必备命令

Supervisor admin 1年前 (2019-06-09) 70次浏览 0个评论 扫描二维码

supervisord : supervisor的服务器端部分,用于supervisor启动
supervisorctl:启动supervisor的命令行窗口,在该命令行中可执行start、stop、status、

1.手动启动:

supervisord -c /etc/supervisor/supervisord.conf 

2.查看已启动服务

pstree -p | grep supervisord 

3.查看log日志

cat  /tmp/supervisord.log

4.用 supervisorctl 查看已经被监控的program

(注:直接用 #supervisorctl 会提示:http://localhost:9001 refused connection)

supervisorctl -c /etc/supervisor/supervisord.conf

5.执行supervisorctl reload的命令可以重启监控服务

supervisorctl reload  

6.supervisorctl status命令查看运行状态

supervisorctl status

7. supervisord,初始启动Supervisord,启动、管理配置中设置的进程。

supervisorctl stop programxxx,停止某一个进程(programxxx),programxxx为[program:mhqdemo]里配置的值,这个示例就是mhqdemo。

supervisorctl start programxxx,启动某个进程
supervisorctl restart programxxx,重启某个进程
supervisorctl stop all,停止全部进程,注:start、restart、stop都不会载入最新的配置文件。
supervisorctl reload,载入最新的配置文件,并按新的配置启动、管理所有进程。

以下参考文章 :supervisor常用命令

查看任务状态

# supervisorctl status
SmartCoin                        RUNNING   pid 13203, uptime 0:04:05
coin                             RUNNING   pid 30744, uptime 17 days, 20:45:18
deepwellserver                   RUNNING   pid 30257, uptime 30 days, 4:13:01
jingtumassetapi                  RUNNING   pid 14536, uptime 45 days, 19:18:08
moac                             RUNNING   pid 20015, uptime 15 days, 5:15:11
new                              RUNNING   pid 10041, uptime 43 days, 22:41:56
nginx                            RUNNING   pid 18752, uptime 22:59:40
redis                            RUNNING   pid 14542, uptime 45 days, 19:18:08
sonyflakeserver                  FATAL     can't find command 'go'
sparkportal                      RUNNING   pid 26073, uptime 1 day, 23:11:17
sparkportal2                     RUNNING   pid 25732, uptime 1 day, 23:11:21
sparkportal3                     RUNNING   pid 25834, uptime 1 day, 23:11:20
sparkportal4                     RUNNING   pid 25974, uptime 1 day, 23:11:18
sparkuser                        RUNNING   pid 26957, uptime 9 days, 23:07:21
sparkwallet                      RUNNING   pid 29045, uptime 5 days, 15:11:58
summaryservice                   RUNNING   pid 14535, uptime 45 days, 19:18:08

第一列是服务名;第二列是运行状态,RUNNING表示运行中,FATAL 表示运行失败,STARTING表示正在启动,STOPED表示任务已停止; 第三/四列是进程号,最后是任务已经运行的时间。

查看单个任务状态: supervisorctl status 服务名

# supervisorctl status sparkportal
sparkportal                      RUNNING   pid 26073, uptime 1 day, 23:12:10

启动/停止/重启任务

1.启动任务

supervisorctl start 服务名

# supervisorctl stop sparkportal
sparkportal: stopped
#supervisorctl status sparkportal
sparkportal                      STOPPED   Jan 05 01:59 PM

2.停止任务

supervisorctl stop 服务名

# supervisorctl start sparkportal
sparkportal: started
# supervisorctl status sparkportal
sparkportal                      RUNNING   pid 32207, uptime 0:00:05

3.重启任务

supervisorctl restart 服务名

# supervisorctl restart sparkportal
sparkportal: stopped
sparkportal: started
# supervisorctl status sparkportal
sparkportal                      RUNNING   pid 4952, uptime 0:00:03

codeobj , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:supervisord监控服务必备命令
喜欢 (0)
[a37free@163.com]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址