1.环境说明
| 角色 | 主机名 | IP | 系统版本 |
|---|---|---|---|
| sa管理机 | sy-gmh-sa-vm3.shaoyan.pro | 192.168.168.3 | CentOS Linux release 7.6.1810 (Core) |
这里先徒手安装,方便介绍,后面会整理到初始化系统脚本里面,一键安装配置好。
2.安装supervisor
使用pip工具安装:
[root@sy-gmh-sa-vm3:~]# pip install supervisorDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.Looking in indexes: https://pypi.doubanio.com/simpleCollecting supervisorDownloading https://pypi.doubanio.com/packages/3f/1c/78026a80b8ff35e7c14adb331efb28e6ff2964dbae7e8bd9c52ef7c377a0/supervisor-4.0.3-py2.py3-none-any.whl (296kB)|████████████████████████████████| 296kB 47kB/sCollecting meld3>=1.0.0 (from supervisor)Downloading https://pypi.doubanio.com/packages/b6/ae/e6d731e4b9661642c1b20591d8054855bb5b8281cbfa18f561c2edd783f7/meld3-1.0.2-py2.py3-none-any.whlInstalling collected packages: meld3, supervisorSuccessfully installed meld3-1.0.2 supervisor-4.0.3
如果 pip 工具没有安装上,那就安装一下:
[root@sy-gmh-sa-vm3:~]# pip --versionpip 19.1.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)# 方法一:通过yum 安装:rpm -ivh http://mirrors.163.com/centos/7/extras/x86_64/Packages/epel-release-7-11.noarch.rpmyum install python-pip# 方法二:通过脚本安装:curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.py
如果你有内部pypi源,可以指定通过它安装噢。用法:
pip install -i http://pypi.shaoyan.pro/simple --trusted-host pypi.shaoyan.pro
3.配置supervisor
[root@sy-gmh-sa-vm3:~]# mkdir /etc/supervisor.d/ # 创建目录用来存放:自定义的配置[root@sy-gmh-sa-vm3:~]# vim /etc/supervisord.conf[root@sy-gmh-sa-vm3:~]# egrep -v ";|^$" /etc/supervisord.conf[unix_http_server][supervisord][rpcinterface:supervisor]supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface[supervisorctl][include]files = /etc/supervisor.d/*.ini[root@sy-gmh-sa-vm3:~]# supervisord/usr/lib/python2.7/site-packages/supervisor/options.py:471: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.'Supervisord is running as root and it is searching '[root@sy-gmh-sa-vm3:~]# ps -ef |grep supervisord |grep -v greproot 11317 1 0 09:20 ? 00:00:00 /bin/python /usr/bin/supervisord
4.使用supervisor
[root@sy-gmh-sa-vm3:~]# supervisorctlsupervisor>
