supervisord

知识点049-supervisor

纵饮孤独 提交于 2019-12-09 22:18:50
supervisor安装 cd /usr/local/src wget https://pypi.python.org/packages/7b/17/88adf8cb25f80e2bc0d18e094fcd7ab300632ea00b601cbbbb84c2419eae/supervisor-3.3.2.tar.gz tar -zxvf supervisor-3.3.2.tar.gz cd supervisor-3.3.2 python setup.py install #本地python版本为python2.7 # python2.7 setup.py install #本地python版本为python3以上 supervisor的功能是对进程的拉取以及监听 生成配置文件 echo_supervisord_conf > /etc/supervisord.conf 启动 supervisord -c /etc/supervisord.conf 常用的启停命令 sudo service supervisor stop 停止supervisor服务 sudo service supervisor start 启动supervisor服务 supervisorctl shutdown #关闭所有任务 supervisorctl stop|start program_name

Supervisor

拟墨画扇 提交于 2019-12-09 21:54:53
1, 简介 Supervisor 是用Python开发的一个client/server服务,是Linux/Unix系统下的一个 进程管理工具 ,不支持Windows系统。它可以很方便的监听、启动、停止、重启一个或多个进程。用Supervisor管理的进程,当一个进程意外被杀死,supervisor监听到进程死后,会自动将它重新拉起,很方便的做到进程自动恢复的功能,不再需要自己写shell脚本来控制。 不使用守护进程会出现的以下问题: 1.1某些程序被杀死后不再运行,导致服务不可用,应用直接挂掉。 1.2 某些进程意外终止后,比如误杀,服务器宕机或需要重启,如果再次启动,需要人为操作,时效性不好。 为了解决这些问题,我们需要有一个程序来监听应用程序的状况。并在应用程序停止运行的时候立即重新启动。 Supervisor包含有两个程序: Supervisor的Server部分称为supervisord,主要负责管理子进程,响应客户端的命令,log子进程的输出,创建和处理不同的事件。 Supervisor的命令行客户端部分称为supervisorctl,它可以与不同的supervisord进程进行通信,获取子进程信息,管理子进程。 2,安装和使用 2.1 安装Python包管理工具( easy_install ) sudo apt-get install python-setuptools

Incorrect user for supervisor'd celeryd

三世轮回 提交于 2019-12-09 16:59:32
问题 I have some periodic tasks that I run with celery (daemonized by supervisord), but after trying to create a directory in the home dir for the user i setup for the supervisor'd process I got a "permission denied" error. After looking at the os.environ dict in a running celery task I noticed that the USER var is set to 'root' and not the user that I set up in my supervisord config for celery. This is what my /usr/local/etc/supervisord.conf looks like: [unix_http_server] file=/tmp/supervisor

高可用etcd集群(三节点) + ssl双向认证

≡放荡痞女 提交于 2019-12-09 16:22:19
# etcd下载地址 https://github.com/etcd-io/etcd/tags wget https://github.com/etcd-io/etcd/releases/download/v3.1.20/etcd-v3.1.20-linux-amd64.tar.gz # 创建etcd启动用户 useradd -s /sbin/nologin -M etcd # 设置etcd工作空间  tar -xf etcd-v3.1.20-linux-amd64.tar.gz -C /opt/ mv etcd-v3.1.20-linux-amd64 etcd-v3.1.20 ln -s etcd-v3.1.20 etcd # 创建etcd工作目录 mkdir -p /opt/etcd/certs /data/etcd /data/logs/etcd-server # 将提前生成好的etcd双向证书放置/opt/etcd/certs目录 [root@hdss7-12 opt]# ls /opt/etcd/certs/ ca.pem etcd-peer-key.pem etcd-peer.pem # 创建etcd启动脚本 /opt/etcd/etcd-server-startup.sh #!/bin/sh ./etcd --name etcd-server-7-12 \ -

How does `supervisorctl tail` work, for a given process?

我怕爱的太早我们不能终老 提交于 2019-12-09 15:50:20
问题 Where does supervisorctl tail take the log information of a certain process from? How do I get a full log? 回答1: From the command line help ( supervisorctl help tail ): tail [-f] <name> [stdout|stderr] (default stdout) Ex: tail -f <name> Continuous tail of named process stdout Ctrl-C to exit. tail -100 <name> last 100 *bytes* of process stdout tail <name> stderr last 1600 *bytes* of process stderr So by default, the tail command tails the process stdout. If you need to get the full log, the

How can I set the PATH for supervisord so it finds the executables

做~自己de王妃 提交于 2019-12-09 15:44:59
问题 I'm trying to setup supervisor.conf . One of my apps requires node.js, but node is not installed system wise. Also, because it needs to bind to port 80 it need to run as root. How can I modify the PATH variable so that supervisord can find the node executable (which is located in a directory) and run the node.js app. I'm trying to do it like this [supervisord] environment=PATH=/path/to/where/node/executable/is [program:web] command=node web.js -c config.json This fails with 2011-08-25 16:49

flask+nginx+uwsgi+supervisor部署到Ubuntu18.04

久未见 提交于 2019-12-09 15:16:23
0.准备 将flask项目放到/var/www目录下 设置app.py端口为0.0.0.0 if __name__ == '__main__': app.run(host='0.0.0.0') 1、安装pip3 apt-get install -y python3-pip 2、安装virtualenv pip3 install virtualenv 在项目路径下创建虚拟环境 virtualenv venv 激活虚拟环境 source venv/bin/activate 进行相关依赖包的安装 3、安装Nginx apt-get install -y nginx 配置Nginx 创建并配置Nginx配置文件 vi /etc/nginx/sites-enabled/web.conf 添加 server { listen 80; server_name xxx.xxx.xxx.xxx; charset utf-8; client_max_body_size 75M; location / { try_files $uri @yourapplication; } location @yourapplication { include uwsgi_params; uwsgi_pass unix:/var/www/data_analysis/data_analysis_uwsgi.sock; }

Is supervisord needed for docker+gunicorn+nginx?

丶灬走出姿态 提交于 2019-12-08 19:16:37
问题 I'm running django with gunicorn inside docker, my entry point for docker is: CMD ["gunicorn", "myapp.wsgi"] Assuming there is already a process that run the docker when the system starts and restart the docker container when it stops, do I even need to use supervisord? if gunicorn will crash won't it crash the docker and then restart? 回答1: The only time you need something like supervisord (or other process supervisor) in a Docker container is if you need to start up multiple independent

system variables are not visible to supervisor

强颜欢笑 提交于 2019-12-08 11:15:35
问题 I have a docker container with supervisor that launch some php jobs. I need to pass env variable to the php job. However is not working. I added: in [supervisor] environment=APP_ENV="%(ENV_APP_ENV)s",APP_DEBUG="%(ENV_APP_DEBUG)s" And when I try to launch supervisor I receive: Starting supervisor: Error: Format string 'APP_ENV="%(ENV_APP_ENV)s",APP_DEBUG="%(ENV_APP_DEBUG)s"' for 'supervisord.environment' contains names ('ENV_APP_ENV') which cannot be expanded. Available names: ENV_LANG, ENV

supervisord logging tornado errors twice in the stdout

我的未来我决定 提交于 2019-12-08 10:56:17
问题 My supervisord config is the following [supervisord] nodaemon=true logfile=/dev/null logfile_maxbytes=0 logfile_maxbytes=0 ; (max main logfile bytes b4 rotation;default 50MB) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=info ; (log level;default info; others: debug,warn,trace) user=root group=root [program:tornado] command=python3 tornadoaas.py directory=/tornado_api stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr