• centos 7.5 安装 suppervisor



    centos 7.5 安装 suppervisor

    Supervisor是用Python开发的Linux/Unix系统下的一个进程管理工具。它可以使进程脱离终端,变为后台守护进程(daemon)。实时监控进程状态,异常退出时能自动重启。
    Supervisor需要Python2.4或更高版本的Python2.x下工作.

    1.安装

    yum install python-setuptools
    easy_install supervisor

    2.配置
    创建目录
    mkdir /etc/supervisord.d
    mkdir /etc/supervisord.d/conf.d

    3.配置
    生成配置文件
    echo_supervisord_conf > /etc/supervisord.d/supervisord.conf

    4.用xftp修改/etc/supervisord.d/supervisord.conf,把最后读配置的路径设成上面新建的文件夹,后缀改成.conf。
    以后我们的配置都放到/etc/supervisord.d/conf.d文件夹里。
    ;[include]
    ;files = relative/directory/*.ini

    [include]
    files=/etc/supervisord.d/conf.d/*.conf

    5.运行
    运行supervisord

    supervisord -c /etc/supervisord.d/supervisord.conf
    1如果运行后修改了配置,执行以下指令重新运行

    supervisorctl reload
    1查看.net core站点是否已启动

    ps -ef | grep dotnet

    如报错:
    unix:///etc/supervisord.d/supervisor.sock refused connectio 错误处理:
    执行:1,2
    1.supervisord -c /etc/supervisord.d/supervisord.conf
    2.supervisorctl -c /etc/supervisord.d/supervisord.conf

    如果运行后修改了配置,执行以下指令重新运行

    supervisorctl reload
    reload
    update
    status
    quit


    开机自动启动supervisor

    服务配置
    为Supervisor新建一个服务脚本supervisord.service,上传到/usr/lib/systemd/system/目录
    supervisord.service内容如下:


    # dservice for systemd (CentOS 7.0+)
    # by ET-CS (https://github.com/ET-CS)
    [Unit]
    Description=Supervisor daemon

    [Service]
    Type=forking
    ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
    ExecStop=/usr/bin/supervisorctl shutdown
    ExecReload=/usr/bin/supervisorctl reload
    KillMode=process
    Restart=on-failure
    RestartSec=42s

    [Install]
    WantedBy=multi-user.target

    开机自启动
    systemctl enable supervisord
    1
    常用管理指令
    supervisorctl restart <application name> ;重启指定应用
    supervisorctl stop <application name> ;停止指定应用
    supervisorctl start <application name> ;启动指定应用
    supervisorctl restart all ;重启所有应用
    supervisorctl stop all ;停止所有应用
    supervisorctl start all ;启动所有应用

    管理页面
    Supervisor是有web管理页面的,只是默认没有开启。如果需要可以修改配置/etc/supervisor/supervisord.conf。
    去掉inet_http_server 注释:

    [inet_http_server] ; inet (TCP) server disabled by default
    port=0.0.0.0:9001 ; ip_address:port specifier, *:port for all iface
    username=aben ; default is no username (open server)
    password=123 ; default is no password (open server)

    http:ip:9001

    api.conf

    [program: api]
    command=dotnet oa.API.dll ; 运行程序的命令
    directory=/root/webapi/oa.API_yizhi ; 命令执行的目录
    autorestart=true ; 程序意外退出是否自动重启
    autostart=true ; 是否自动启动
    user=root ; 进程执行的用户身份
    stopsignal=INT
    startsecs=15 ; 自动重启间隔

  • 相关阅读:
    Leetcode: Rotate Image
    Leetcode: Longest Palindromic Substring && Summary: Palindrome
    Leetcode: Reverse Nodes in k-Group
    Leetcode: Substring with Concatenation of All Words
    Leetcode: Merge k Sorted List
    Summary: Java中函数参数的传递
    Leetcode: Generate Parentheses
    超级wifi
    路由器中继(repeater)模式 和 AP+WDS模式区别?
    route 的标志位
  • 原文地址:https://www.cnblogs.com/csj007523/p/14226518.html
Copyright © 2020-2023  润新知