yarn的节点都是localhost_可视化集中管理服务器节点进程

519b6c0698eebe715ad19471dbb1538e.png

阅读本文大约需要1.5分钟。

背景

在之前的文章《自动化测试之进程管理》中讲到了用Supervisor做进程管理的好处,可以很方便的用来启动、重启、关闭进程,类似于 Linux 的 systemd 守护进程一样,通过统一的命令来管理系统的各个服务,当管理的服务挂掉时会自动重新拉起,如果只有一台服务器的情况下,问题倒不大,但是如果你有一个自动化集群,部署着数十个进程服务,那么管理和维护成本就会陡增。

今天就来给大家分享一个解决方案 - CeSi,该工具是 Supervisor 的 WebUI,可以通过这个统一的 WebUI 集中化管理各个服务器节点的进程。

CeSi的安装和部署

CeSi 是 Supervisor 官方推荐的集中化管理 Supervisor 实例的 Web UI,该工具是用 Python 编写的,基于 Flask Web 框架 。

Superviosr 自带的 Web UI 不支持跨机器管理,Supervisor 进程功能比较简单,通过 CeSi 可以集中管理各个服务器节点的进程,在 Web 界面就可以轻松管理各个服务的启动、关闭、重启等,使用很方便。

安装

以Ubuntu为例,具体的安装步骤如下:

$ sudo apt install -y git python3 python3-pip python3-venv$ # If you want to change CESI_SETUP_PATH, you must change the configurations in the cesi.service file.$ export CESI_SETUP_PATH=/opt/cesi$ mkdir ${CESI_SETUP_PATH}$ cd ${CESI_SETUP_PATH}$ # Download the project to CESI_SETUP_PATH directory$ wget https://github.com/gamegos/cesi/releases/download/v2.7.1/cesi-extended.tar.gz -O cesi.tar.gz$ tar -xvf cesi.tar.gz$ # Create virtual environment and install requirement packages$ python3 -m venv venv$ source venv/bin/activate(venv) $ pip3 install -r requirements.txt(venv) $ deactivate   # Deactivate virtual environment$ # Build ui (First you must install dependencies for ui -> yarn) - Optional$ cd ${CESI_SETUP_PATH}/cesi/ui$ yarn install$ yarn build$ # Create cesi.conf.toml file and update cesi.conf.toml for your environment.$ # Config file documentation can be found inside default file.$ # (You must create cesi.conf in the etc directory for cesi.service)$ sudo cp ${CESI_SETUP_PATH}/defaults/cesi.conf.toml /etc/cesi.conf.toml$ # Run as a service$ sudo cp ${CESI_SETUP_PATH}/defaults/cesi.service /etc/systemd/system/cesi.service$ sudo systemctl daemon-reload$ sudo systemctl start cesi

配置

CeSi 的配置非常简单,和 Supervisor 的配置文件类似,配置文件路径:

/etc/cesi.conf.toml

只需要把nodes部分填充为自己的各个服务器节点信息就可以了,含义可以看注释部分。

# This is the main CeSI toml configuration file. It contains CeSI web application and# supervisord information to connect# This is the CeSI's own configuration.[cesi]# Database Uridatabase = "sqlite:///users.db"                         # Relative path# Etc#database = "sqlite:opt/cesi/< version >/users.db"  # Absolute path#database = "postgres://:@localhost:5432/"#database = "mysql+pymysql://:@localhost:3306/"activity_log = "activity.log"   # File path for CeSI logsadmin_username = "admin"        # Username of admin useradmin_password = "admin"        # Password of admin user# This is the definition section for new supervisord node.# [[nodes]]# name = "api"          # (String) Unique name for supervisord node.# environment = ""      # (String) The environment name provides logical grouping of supervisord nodes. It can be used as filtering option in the UI.# username = ""         # (String) Username of the XML-RPC interface of supervisord Set nothing if no username is configured# password = ""         # (String) Password of the XML-RPC interface of supervisord. Set nothing if no username is configured# host = "127.0.0.1"    # (String) Host of the XML-RPC interface of supervisord# port = "9001"         # (String) Port of the XML-RPC interface of supervisord# Default supervisord nodes[[nodes]]name = "专项服务器"environment = ""username = "test"password = "test"host = ""port = "9001"[[nodes]]name = "主服务器"environment = ""username = "test"password = "test"host = ""port = "9001"

最终的效果图如下:

c2e0e5d189c1dd891d49530dcefdb92b.png

推荐阅读:

推荐一个不错的弱网模拟框架

Android内存性能测试

大疆御 Air 无人机上手的第100天

iOS模拟动态定位的测试方案

Android CPU性能测试

想要明白些道理,遇见些有趣的事 —— 离岛

8698dfe22e739b69fd67e94eaef60830.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值