第一篇supervisor集群管理工具cesi安装详解-如何安装supervisor

环境

系统centos7
python默认2.7.5
没有外网没有yum环境

准备

我在网上下载好了

python3.7.4

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz

supervisor-4.2.2.tar.gz

supervisor也去官方下载吧
https://pypi.org/project/supervisor/

安装python3.7.4

[root@host-192-168-65-94 supervisor]# tar -xf Python-3.7.4.tgz
[root@host-192-168-65-94 supervisor]# ll
total 22484
drwxr-xr-x. 18  501  501     4096 Jul  9  2019 Python-3.7.4
-rw-r--r--.  1 root root 23017663 May 24 11:08 Python-3.7.4.tgz
[root@host-192-168-65-94 supervisor]# cd Python-3.7.4/
[root@host-192-168-65-94 Python-3.7.4]# ./configure --prefix=/data/supervisor/python3.7
[root@host-192-168-65-94 Python-3.7.4]# make -j 4 && make install

问题

from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named ‘_ctypes’
make: *** [install] Error 1
如果和上面安装方式一样,python3.7在make install时会报错
from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' make: *** [install] Error 1

解决方法

安装libffi-devel,没有yum源的话,可以参考本地yun源搭建安装本地yum源_yum仓库

yum install libffi-devel 

安装上libffi后,再重新编译python

./configure --prefix=/data/supervisor/python3.7
make -j 8 && make install

OK,python安装上了

安装supervisor

上传supervisor-4.2.2.tar.gz

[root@host-192-168-65-94 supervisor]# tar -xf supervisor-4.2.2.tar.gz 
[root@host-192-168-65-94 supervisor]# ll
total 22940
drwxr-xr-x.  6 root root        56 May 24 15:47 python3.7
drwxr-xr-x. 19  501   501     4096 May 24 15:53 Python-3.7.4
-rw-r--r--.  1 root root  23017663 May 24 11:08 Python-3.7.4.tgz
drwxr-xr-x.  5  501 games      224 Feb 27 04:45 supervisor-4.2.2
-rw-r--r--.  1 root root    463657 May 20 09:29 supervisor-4.2.2.tar.gz
[root@host-192-168-65-94 supervisor]# 
[root@host-192-168-65-94 supervisor]# cd supervisor-4.2.2/
[root@host-192-168-65-94 supervisor-4.2.2]# ../python3.7/bin/python3.7 setup.py build
[root@host-192-168-65-94 supervisor-4.2.2]# ../python3.7/bin/python3.7 setup.py install
[root@host-192-168-65-94 supervisor-4.2.2]# ls ../python3.7/bin/ -l
total 27384
lrwxrwxrwx. 1 root root        8 May 24 16:02 2to3 -> 2to3-3.7
-rwxr-xr-x. 1 root root      117 May 24 16:02 2to3-3.7
-rwxr-xr-x. 1 root root      257 May 24 16:02 easy_install-3.7
-rwxr-xr-x. 1 root root      443 May 24 16:16 echo_supervisord_conf
lrwxrwxrwx. 1 root root        7 May 24 16:02 idle3 -> idle3.7
-rwxr-xr-x. 1 root root      115 May 24 16:02 idle3.7
-rwxr-xr-x. 1 root root      417 May 24 16:16 pidproxy
-rwxr-xr-x. 1 root root      239 May 24 16:02 pip3
-rwxr-xr-x. 1 root root      239 May 24 16:02 pip3.7
lrwxrwxrwx. 1 root root        8 May 24 16:02 pydoc3 -> pydoc3.7
-rwxr-xr-x. 1 root root      100 May 24 16:02 pydoc3.7
lrwxrwxrwx. 1 root root        9 May 24 16:02 python3 -> python3.7
-rwxr-xr-x. 2 root root 13994184 May 24 16:01 python3.7
lrwxrwxrwx. 1 root root       17 May 24 16:02 python3.7-config -> python3.7m-config
-rwxr-xr-x. 2 root root 13994184 May 24 16:01 python3.7m
-rwxr-xr-x. 1 root root     2918 May 24 16:02 python3.7m-config
lrwxrwxrwx. 1 root root       16 May 24 16:02 python3-config -> python3.7-config
lrwxrwxrwx. 1 root root       10 May 24 16:02 pyvenv -> pyvenv-3.7
-rwxr-xr-x. 1 root root      457 May 24 16:02 pyvenv-3.7
-rwxr-xr-x. 1 root root      427 May 24 16:16 supervisorctl
-rwxr-xr-x. 1 root root      423 May 24 16:16 supervisord
[root@host-192-168-65-94 supervisor-4.2.2]# 

欧了,现在我把supervisor也安装上了

配置supervisor服务

[root@host-192-168-65-94 supervisor]# mkdir /var/log/supervisor
[root@host-192-168-65-94 supervisor]# mkdir -p conf/conf.d
[root@host-192-168-65-94 supervisor]# cat conf/supervisord.ini 
; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

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

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

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

启动supervisord

[root@host-192-168-65-94 supervisor]# python3.7/bin/supervisord -c conf/supervisord.ini

添加一个服务

[root@host-192-168-65-94 conf.d]# cd /data/supervisor/conf/conf.d/
[root@host-192-168-65-94 conf.d]# cat gateway.ini 
[program:gateway]
command=/usr/local/java/jdk1.8.0_151/bin/java -jar /pro/gateway/carsoa-gateway.jar
autostart=true
autorestart=true
user=root
startsecs=1
startretries=3
redirect_stderr=true
stdout_logfile=/pro/gateway/nohup.out
stderr_logfile=/pro/gateway/nohup.out

管理服务

[root@host-192-168-65-94 conf.d]# /data/supervisor/python3.7/bin/supervisorctl -c /data/supervisor/conf/supervisord.ini
supervisor> start gateway
gateway: started
supervisor> 
supervisor> status 
gateway                          RUNNING   pid 11970, uptime 0:00:23

可以了,如果您觉得有帮忙请点赞!

版权声明:本文为作者原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原创文章,作者:老C,如若转载,请注明出处:https://www.code404.icu/658.html

发表评论

登录后才能评论