• 关于supervisord配置文件的使用


    参考文献Supervisor使用详解

    How to keep Celery running with supervisor

    Installation

    First, you need to install supervisor in your virtualenv and generate a configuration file.

    I store a supervisord.conf config file at the root of each project, and also, be careful to use the absolute path to the Python interpreter of the virtualenv.

    $ pip install supervisor
    $ cd /path/to/your/project
    $ echo_supervisord_conf > supervisord.conf
    

    Next, just add this section after the [supervisord] section:

    [program:celeryd]
    command=/home/thomas/virtualenvs/yourvenv/bin/celery -A=myapp.main worker -l info 
    stdout_logfile=/path/to/your/logs/celeryd.log
    stderr_logfile=/path/to/your/logs/celeryd.log
    autostart=true
    autorestart=true
    startsecs=10
    stopwaitsecs=600
    

    It's a simplified version of the Celery supervisor example configuration file, adapted to work with virtualenvs.

    Usage

    Just run supervisord in your project directory.

    $ supervisord
    

    Then, you can use the supervisorctl command to enter the interactive shell. Type help to get started. You can also execute supervisor command directly:

    $ supervisorctl tail celeryd
    $ supervisorctl restart celeryd
    
    常用配置
    supervisorctl status : 查看所管理的服务状态; 
    supervisorctl start <program_name>:启动一个服务; 
    supervisorctl restart <program_name>:重启一个服务(注意:重启服务不会重新加载配置文件); 
    supervisorctl stop <program_name>:关闭一个服务; 
    supervisorctl update:重新加载配置文件,并重启配置有变动的服务; 
    supervisorctl reread:重新加载配置文件,但不会重启配置有变动的服务; 
    supervisorctl reload:重启 Supervisor 服务端; 
    supervisorctl clear <program_name>:清理一个服务的 stdout log;
    
    修改配置以后这样重新启动

    首先进入 supervisor 控制台:

    supervisorctl
    

    然后重新读取配置:

    reread
    

    更新配置:

    update
    

    开始所有配置:

    start all
    

    查看所有状态:

    status
    

    配置文件的内容,可以这样写:

    [include]
    files = supervisord.d/*.ini
    

    然后在supervisord.conf相同路径下的supervisord.d文件夹下,创建你需要的.ini配置文件
    例如
    test 09:59:38 ✿゚ root@supervisord.d $ls
    a.ini b.ini c.ini d.ini
    e.ini f.ini g.ini
    内容和上面的差不多:

    [program:name]
    command=/root/.pyenv/versions/3.7.3/bin/python /root/bin/test/server/bin/start_test.py
    user=root
    directory=/root/bin/test
    stdout_logfile=/root/log/sup/test_aiera.log
    stderr_logfile=/root/log/sup/test_aiera.log
    autostart=true
    autorestart=true
    redirect_stderr=true
    killasgroup = true
    startsecs=2
    loglevel=info
    #numprocs = 4
    #numprocs_start = 1
    
    
  • 相关阅读:
    CentOS6.4 64位系统安装jdk
    oracle安装界面中文乱码解决
    亦步亦趋在CentOS 6.4下安装Oracle 11gR2(x64)
    CentOS 6.3(x86_64)下安装Oracle 10g R2
    Spring中映射Mongodb中注解的解释
    MongoDB 创建基础索引、组合索引、唯一索引以及优化
    MongoDB 用MongoTemplate查询指定时间范围的数据
    Java获取泛化类型
    SpringBoot标准Properties
    java如何获取一个对象的大小【转】
  • 原文地址:https://www.cnblogs.com/pywjh/p/15582997.html
Copyright © 2020-2023  润新知