详细解读cesi+supervisor可视化集中管理服务器节点进程

简介: 详细解读cesi+supervisor可视化集中管理服务器节点进程

Supervisor 的安装及基本使用

supervisor 文章跳转

开启supervisor 的 web服务

【inet_http_server】 ;HTTP服务器,提供web管理界面

port=0.0.0.0:9001 ;Web管理后台运行的IP和端口,如果开放到公网,需要注意安全性

username=root ;登录管理后台的用户名

password=123 ;登录管理后台的密码

安装配置 CeSi

1. 简介

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

Superviosr 自带的 Web UI 不支持跨机器管理

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

2. 安装

CeSi 已经有了新的版本,在 GitHub 仓库的 v2_api 分支下,提供了比之前版本更加美观的界面,以下为 CeSi 一键安装配置脚本:

yum install wget

yum install git

python 安装

export CESI_SETUP_PATH=~/cesi

mkdir ${CESI_SETUP_PATH}//代码效果参考:http://www.ezhiqi.com/bx/art_1147.html

cd ${CESI_SETUP_PATH}

# Download the project to ~/cesi directory

wget -O cesi.tar.gz

tar -xvf cesi.tar.gz

# Create virtual environment and install requirement packages

python3 -m venv venv

source venv/bin/activate

pip3 install -r requirements.txt

3. 配置

# Create cesi conf

cp /usr/local/defaults/cesi.conf.toml /etc/cesi.conf

vim /etc/cesi.conf

【cesi】

# Database Uri

database = "" # Relative path

# Etc

#database = "" # Absolute path

#database = "

@localhost:5432/"

#database = "mysql+

@localhost:3306/"

activity_log = "activity.log" # File path for CeSI logs

admin_username = "admin" # Username of admin user

admin_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 = "count_1"

environment = "count"

username = "root"

password = "123"

host = "192.168.0.239"

port = "9190"

【【nodes】】

name = "count_2"

environment = "count"

username = "root"

password = "123"

host = "192.168.0.240"

port = "9190"

【【nodes】】

name = "count_3"

environment = "count"

username = "root"

password = "123"

host = "192.168.0.71"

port = "9190"

注意:CeSi 的配置文件路径必须是 /etc/cesi.conf ,否则启动会报错,简单看下 CeSi 的源码就知道为什么了。在这里我在仓库目录弄了个软连接指向了 /etc/cesi.conf,完全是为了编辑方便弄的。

4. 启动

CeSi 的启动非常简单,直接通过 Python 启动即可:

/usr/local/venv/bin/python3 /usr/local/cesi/run.py --config-file /etc/cesi.conf -p 9191

1

为了方便管理,我把 CeSi 也通过 Supervisor 来管理,以下为对应的 Supervisor 配置:

创建日志文件

mkdir -p /var/log/supervisor/cesi/

【program:cesi】

directory=/usr/local/cesi

command=/usr/local/venv/bin/python3 /usr/local/cesi/run.py --config-file /etc/cesi.conf -p 9191

stderr_logfile=/var/log/supervisor/cesi/cesi.log

stdout_logfile=/var/log/supervisor/cesi/cesi.out

autostart=true

autorestart=true

stopasgroup=true

killasgroup=true

startsecs=180

相关文章
|
2月前
|
Prometheus 监控 Cloud Native
使用supervisor守护Prometheus进程
使用supervisor守护Prometheus进程
|
2月前
|
运维 算法 调度
深入理解操作系统:进程调度与优先级自动化运维:使用Ansible实现服务器集群管理
【8月更文挑战第27天】在操作系统的众多奥秘中,进程调度无疑是一个既简单又复杂的主题。它就像是交响乐团中的指挥,协调着每一个音符,确保乐曲和谐而有序地进行。本文将带领读者走进进程调度的世界,探索其背后的原理和实现,同时通过代码示例揭示其精妙之处。让我们一起揭开进程调度的神秘面纱,理解它在操作系统中的重要性。
|
2月前
|
C语言
【C语言】多进程服务器
【C语言】多进程服务器
18 4
|
2月前
使用supervisor守护freeswitch进程
使用supervisor守护freeswitch进程
|
3月前
|
Ubuntu Unix Linux
如何使用 Supervisor 管理你的进程
**Supervisor** 是一款Python编写的进程管理工具,用于类Unix系统,确保应用服务持续运行。常用命令包括:`reload`(重新加载配置)、`status`(查看进程状态)、`shutdown`(关闭所有进程)、`start`和`stop`(控制单个进程)。在CentOS上安装Supervisor用`yum install -y supervisor`,配置文件通常在`/etc/supervisord.conf`。
51 0
|
4月前
|
存储 算法 搜索推荐
Cloudstack多个管理服务器节点
Cloudstack多个管理服务器节点
|
4月前
|
监控 Linux 应用服务中间件
探索Linux中的`ps`命令:进程监控与分析的利器
探索Linux中的`ps`命令:进程监控与分析的利器
|
3月前
|
运维 关系型数据库 MySQL
掌握taskset:优化你的Linux进程,提升系统性能
在多核处理器成为现代计算标准的今天,运维人员和性能调优人员面临着如何有效利用这些处理能力的挑战。优化进程运行的位置不仅可以提高性能,还能更好地管理和分配系统资源。 其中,taskset命令是一个强大的工具,它允许管理员将进程绑定到特定的CPU核心,减少上下文切换的开销,从而提升整体效率。
掌握taskset:优化你的Linux进程,提升系统性能
|
3月前
|
弹性计算 Linux 区块链
Linux系统CPU异常占用(minerd 、tplink等挖矿进程)
Linux系统CPU异常占用(minerd 、tplink等挖矿进程)
88 4
Linux系统CPU异常占用(minerd 、tplink等挖矿进程)
|
2月前
|
算法 Linux 调度
探索进程调度:Linux内核中的完全公平调度器
【8月更文挑战第2天】在操作系统的心脏——内核中,进程调度算法扮演着至关重要的角色。本文将深入探讨Linux内核中的完全公平调度器(Completely Fair Scheduler, CFS),一个旨在提供公平时间分配给所有进程的调度器。我们将通过代码示例,理解CFS如何管理运行队列、选择下一个运行进程以及如何对实时负载进行响应。文章将揭示CFS的设计哲学,并展示其如何在现代多任务计算环境中实现高效的资源分配。
下一篇
无影云桌面