安装

yum install supervisor
touch /var/run/supervisor/supervisor.sock
chmod 777 /var/run/supervisor/supervisor.sock
supervisord
supervisorctl start all
supervisorctl status

配置目录:/etc/supervisor.d

基于swoft的配置

[program:user-center-gift]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /home/www/userCenter/bin/swoft gift:write
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/home/www/supervisor_user-center-gift.log [program:test]
# 设置命令在指定的目录内执行
directory=/www/go/src/gin-api
# 这里为您要管理的项目的启动命令
command=/www/go/src/gin-api/test
# 以哪个用户来运行该进程
user=root
# supervisor 启动时自动该应用
autostart=true
# 进程退出后自动重启进程
autorestart=true
# 进程持续运行多久才认为是启动成功
startsecs=1
# 重试次数
startretries=3
# stderr 日志输出位置
stderr_logfile=/www/go/src/gin-api/runtime/stderr.log
# stdout 日志输出位置
stdout_logfile=/www/go/src/gin-api/runtime/stdout.log

命令

#查看所有服务的状态
supervisorctl status
服务名 = user-center-gift:user-center-gift_00
#启动服务
supervisorctl start 服务名
#停止服务
supervisorctl stop 服务名
#重启服务
supervisorctl restart 服务名

常见报错

端口占用

Starting supervisor: Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /usr/bin/supervisord -h

显示的是有另一个进程占用了监听端口

查出来 kill掉
ps -ef | grep supervisord

提示setuptools版本问题

/usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:21: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please follow up at
https://bit.ly/setuptools-py2-warning.
************************************************************
sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
supervisor>

先看下版本

root@xxxxxx:~# which python
/usr/bin/python
root@xxxxxx:~# /usr/bin/python -V
Python 2.7.12 root@xxxxxx:~# which pip
/usr/bin/pip
root@xxxxxx:~# pip -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

升级

pip2 install --upgrade --user pip

#使用pip 9.x或更高版本的Setuptools或固定setuptools<45在您的环境中
pip2 install --user "setuptools<45"

supervisor 安装和基本使用的更多相关文章

  1. supervisor安装和配置

    直接命令 easy_install supervisor 如果报错先安装 yum install python-setuptools,再上面一条命令: 安装成功后显示finished,我们再次进行py ...

  2. Supervisor 安装及配置管理uwsgi进程

    Supervisor介绍 Supervisor 允许其用户在UNIX类操作系统上控制多个进程. 块如下: 方便 需要为每个进程实例编写rc.d脚本通常是不方便的. rc.d脚本是进程初始化/自动启动/ ...

  3. mac下supervisor安装及简单配置

    supervisor是一个用 Python 写的进程管理工具,可以很方便的用来启动.重启.关闭进程(守护进程).可以用他来管理自己的“服务程序”. 安装 首先安装Python,Mac系统好像自带. 执 ...

  4. supervisor安装、使用详解

    supervisor是用python写的一个进程管理工具,用来启动,重启,关闭进程. 1 supervisor的安装 pip install supervisor 2 supervisor的配置文件( ...

  5. supervisor安装部署和使用实例

    Supervisord是用Python实现的一款非常实用的进程管理工具,类似于monit,monit和supervisord的一个比较大的差异是supervisord管理的进程必须由superviso ...

  6. Supervisor安装与配置(Linux/Unix进程管理工具)

    原文链接:http://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyth ...

  7. Linux系统下 Supervisor 安装搭建(yum安装)

    安装Supervisor # 安装supervisor yum install supervisor # 打开supervisor的配置文件 vi /etc/supervisord.conf 将sup ...

  8. Linux系统下 Supervisor 安装搭建

    在 web 应用部署到线上后,需要保证应用一直处于运行状态,在遇到程序异常.报错等情况,导致 web 应用终止时,需要保证程序可以立刻重启,继续提供服务. 所以,就需要一个工具,时刻监控 web 应用 ...

  9. supervisor安装及其配置

    一.supervisor概述 supervisor是一个c/s系统,被用来在类Unix系统中监控进程状态.supervisor使用python开发. 服务端进程为supervisord,主要负责启动自 ...

  10. Supervisor安装与配置

    Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...

随机推荐

  1. linux安装nvm和node

    linux安装nvm和node 一.环境 debian10 nodejs 二.安装 2.1 安装NVM 运行以下命令下载并运行 NVM 安装脚本: curl https://raw.githubuse ...

  2. .NET Emit 入门教程:第七部分:实战项目1:将 DbDataReader 转实体

    前言: 经过前面几个部分学习,相信学过的同学已经能够掌握 .NET Emit 这种中间语言,并能使得它来编写一些应用,以提高程序的性能. 随着 IL 指令篇的结束,本系列也已经接近尾声,在这接近结束的 ...

  3. Node.js 万字教程

    0. 基础概念 Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,使用了一个事件驱动.非阻塞式 I/O 模型,让 JavaScript 运行在服务端的开发平台. ...

  4. WSL2使用桥接网络,并指定IP

    前言 微软终于解决了宇宙级难题了,一直以来的WSL2每次启动IP都是动态分配的,并且是NAT的网络.当然网上对此也有一些解决方案,编写脚本在启动时修改,但是太麻烦了,这次很完美的解决了这个难题. 检查 ...

  5. vue特殊atribute-is

    1.解决dom内模板限制 有些 HTML 元素,诸如 <ul>.<ol>.<table> 和 <select>,对于哪些元素可以出现在其内部是有严格限制 ...

  6. 移动通信网络中的 3A 实现

    目录 文章目录 目录 3A RADIUS Diameter 基本概念 基本协议 应用协议 freeDiameter 3A AAA,即认证(Authentication).授权(Authorizatio ...

  7. linux下date命令设置时间的输出格式和修改时间

    目录 一.关于linux下的时间 二.linux下使用date命令设置时间的输出格式 三.修改linux时间 3.1 在可以访问Internet情况下修改时间 3.2 在无法访问Internet情况下 ...

  8. 使用tc命令模拟linux网络延迟环境

    tc(Traffic Control)是 Linux 中用于流量控制和网络模拟的强大工具.你可以使用它来模拟网络延迟.带宽限制.数据包丢失等. 以下是一个使用 tc 模拟网络延迟的基本步骤: 1.查看 ...

  9. 研二学妹面试字节,竟倒在了ThreadLocal上,这是不要应届生还是不要女生啊?

    一.写在开头     今天和一个之前研二的学妹聊天,聊及她上周面试字节的情况,着实感受到了Java后端现在找工作的压力啊,记得在18,19年的时候,研究生计算机专业的学生,背背八股文找个Java开发工 ...

  10. .net core 5,6,7【多线程笔记】取消令牌(CancellationToken) CancellationTokenSource

    介绍 在使用C#异步的场景,多多少少会接触到CancellationTokenSource.它和取消异步任务相关的,CancellationToken就是它生产出来的. 演示 任务取消执行回调 var ...