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

  • 介绍
  • 安装
  • 解压
  • 安装依赖
  • 修改配置
  • 注册为系统服务
  • 启动
  • 登录一下,发现报错了
  • 解决方法

介绍

前一篇我们安装好了supervisor,supervisor自带了一个UI界面,不太好用,且不支持集群
CeSi 是 Supervisor 官方推荐的集中化管理 Supervisor 实例的 Web UI,该工具是用 Python 编写,基于 Flask Web 框架 。

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

安装

软件下载地址cesi-extended.tar.gz

https://github.com/gamegos/cesi/releases

上传到服务器

解压

[root@localhost cesi]# pwd
/data/supervisor/cesi
[root@localhost cesi]# tar -xf cesi-extended.tar.gz
[root@localhost cesi]# ll
总用量 9752
drwxr-xr-x. 5 1157137021 1123705078     164 5月  25 10:16 cesi
-rw-r--r--. 1 root       root       9873466 5月  20 13:14 cesi-extended.tar.gz
-rw-r--r--. 1 1157137021 1123705078     360 6月  28 2020 CONTRIBUTORS.md
drwxr-xr-x. 2 1157137021 1123705078      70 5月  25 10:16 defaults
-rw-r--r--. 1 1157137021 1123705078     237 6月  28 2020 DEVELOPMENT.md
-rw-r--r--. 1 1157137021 1123705078    1980 6月  28 2020 docker-compose.yml
-rw-r--r--. 1 1157137021 1123705078      62 6月  28 2020 env.sample
-rw-r--r--. 1 1157137021 1123705078   35146 6月  28 2020 LICENCE
-rw-r--r--. 1 1157137021 1123705078    1186 6月  28 2020 Makefile
-rw-r--r--. 1 1157137021 1123705078   38294 6月  28 2020 poetry.lock
-rw-r--r--. 1 1157137021 1123705078     535 6月  28 2020 pyproject.toml
-rw-r--r--. 1 1157137021 1123705078    3734 6月  28 2020 README.md
-rw-r--r--. 1 1157137021 1123705078      90 6月  28 2020 requirements.txt

安装依赖

[root@localhost cesi]# /data/supervisor/python3.7/bin/pip3 install -r requirements.txt
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting flask==1.1.2 (from -r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94kB)100% |████████████████████████████████| 102kB 2.0MB/s
Collecting flask-sqlalchemy==2.4.3 (from -r requirements.txt (line 2))Downloading http://mirrors.aliyun.com/pypi/packages/a6/b1/9da1c3c5417612b2fc4d25d55a225199c633d6492dac215b11b9021e6a8d/Flask_SQLAlchemy-2.4.3-py2.py3-none-any.whl
Collecting psycopg2-binary==2.8.5 (from -r requirements.txt (line 3))Downloading http://mirrors.aliyun.com/pypi/packages/e6/bc/cb407e8d0301801d5f44d3f464485d9577c3bf92db13afef4d05d757ec47/psycopg2_binary-2.8.5-cp37-cp37m-manylinux1_x86_64.whl (2.9MB)100% |████████████████████████████████| 2.9MB 1.8MB/s
Collecting pymysql==0.9.3 (from -r requirements.txt (line 4))Downloading http://mirrors.aliyun.com/pypi/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whl (47kB)100% |████████████████████████████████| 51kB 2.1MB/s
Collecting tomlkit==0.5.11 (from -r requirements.txt (line 5))Downloading http://mirrors.aliyun.com/pypi/packages/7d/8c/c3ee9cd41b2df781b2dc39c31209724b4f04a3110b46531de2e661ace186/tomlkit-0.5.11-py2.py3-none-any.whl
Collecting itsdangerous>=0.24 (from flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/9c/96/26f935afba9cd6140216da5add223a0c465b99d0f112b68a4ca426441019/itsdangerous-2.0.1-py3-none-any.whl
Collecting Jinja2>=2.10.1 (from flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/80/21/ae597efc7ed8caaa43fb35062288baaf99a7d43ff0cf66452ddf47604ee6/Jinja2-3.0.1-py3-none-any.whl (133kB)100% |████████████████████████████████| 143kB 1.9MB/s
Collecting click>=5.1 (from flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/76/0a/b6c5f311e32aeb3b406e03c079ade51e905ea630fc19d1262a46249c1c86/click-8.0.1-py3-none-any.whl (97kB)100% |████████████████████████████████| 102kB 1.7MB/s
Collecting Werkzeug>=0.15 (from flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/bd/24/11c3ea5a7e866bf2d97f0501d0b4b1c9bbeade102bb4b588f0d2919a5212/Werkzeug-2.0.1-py3-none-any.whl (288kB)100% |████████████████████████████████| 296kB 1.8MB/s
Collecting SQLAlchemy>=0.8.0 (from flask-sqlalchemy==2.4.3->-r requirements.txt (line 2))Downloading http://mirrors.aliyun.com/pypi/packages/aa/e3/d4d75e8f04456d4b636a3dbcd20fd423878f789db3e8881dec89ea38f9b1/SQLAlchemy-1.4.15-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.5MB)100% |████████████████████████████████| 1.5MB 2.0MB/s
Collecting MarkupSafe>=2.0 (from Jinja2>=2.10.1->flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/ad/cd/650b1be2a81674939ef962b1f1b956e4a84116d69708c842667445e95408/MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl
Collecting importlib-metadata; python_version < "3.8" (from click>=5.1->flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/8e/e2/49966924c93909d47612bb47d911448140a2f6c1390aec2f4c1afbe3748f/importlib_metadata-4.0.1-py3-none-any.whl
Collecting greenlet!=0.4.17; python_version >= "3" (from SQLAlchemy>=0.8.0->flask-sqlalchemy==2.4.3->-r requirements.txt (line 2))Downloading http://mirrors.aliyun.com/pypi/packages/bb/ea/c838bae79013f1106092f8cc6b28a60f86fdd7ade899c636f12ff736cdd7/greenlet-1.1.0-cp37-cp37m-manylinux2010_x86_64.whl (160kB)100% |████████████████████████████████| 163kB 1.8MB/s
Collecting typing-extensions>=3.6.4; python_version < "3.8" (from importlib-metadata; python_version < "3.8"->click>=5.1->flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/2e/35/6c4fff5ab443b57116cb1aad46421fb719bed2825664e8fe77d66d99bcbc/typing_extensions-3.10.0.0-py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->click>=5.1->flask==1.1.2->-r requirements.txt (line 1))Downloading http://mirrors.aliyun.com/pypi/packages/0f/8c/715c54e9e34c0c4820f616a913a7de3337d0cd79074dd1bed4dd840f16ae/zipp-3.4.1-py3-none-any.whl
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, typing-extensions, zipp, importlib-metadata, click, Werkzeug, flask, greenlet, SQLAlchemy, flask-sqlalchemy, psycopg2-binary, pymysql, tomlkit
Successfully installed Jinja2-3.0.1 MarkupSafe-2.0.1 SQLAlchemy-1.4.15 Werkzeug-2.0.1 click-8.0.1 flask-1.1.2 flask-sqlalchemy-2.4.3 greenlet-1.1.0 importlib-metadata-4.0.1 itsdangerous-2.0.1 psycopg2-binary-2.8.5 pymysql-0.9.3 tomlkit-0.5.11 typing-extensions-3.10.0.0 zipp-3.4.1
You are using pip version 19.0.3, however version 21.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@localhost cesi]#

修改配置

[root@localhost cesi]# cat defaults/cesi.conf.tomlThis 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 Uri
database = "sqlite:///users.db"                         # Relative path
# Etc
#database = "sqlite:opt/cesi/< version >/users.db"  # Absolute path
#database = "postgres://<user>:<password>@localhost:5432/<database_name>"
#database = "mysql+pymysql://<user>:<password>@localhost:3306/<database_name>"
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 = "192.168.80.176-server"
environment = ""
username = "super"
password = "KsKFaCIX50fDv7kz"
host = "192.168.80.176"
port = "9001"[[nodes]]
name = "192.168.65.94-server"
environment = ""
username = "super"
password = "KsKFaCIX50fDv7kz"
host = "192.168.65.94"
port = "9001"

注册为系统服务

[root@localhost cesi]# cp defaults/cesi.service /etc/systemd/system/
[root@localhost cesi]# cat /etc/systemd/system/cesi.service
[Unit]
Description=cesi[Service]
Environment=
ExecStart=/data/supervisor/python3.7/bin/python3 /data/supervisor/cesi/cesi/run.py --config-file /etc/cesi.conf.toml
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=TERM
User=root
WorkingDirectory=/data/supervisor/cesiRestart=on-failure[Install]
WantedBy=multi-user.target

启动

[root@localhost cesi]# systemctl daemon-reload
[root@localhost cesi]# systemctl restart cesi
[root@localhost cesi]# systemctl status cesi
● cesi.service - cesiLoaded: loaded (/etc/systemd/system/cesi.service; disabled; vendor preset: disabled)Active: active (running) since 二 2021-05-25 10:26:40 CST; 4s agoMain PID: 111963 (python3)Tasks: 1Memory: 34.1MCGroup: /system.slice/cesi.service└─111963 /data/supervisor/python3.7/bin/python3 /data/supervisor/cesi/cesi/run.py --config-file /etc/cesi.conf.toml5月 25 10:26:41 localhost.localdomain python3[111963]: {'admin_username': 'admin', 'database': 'sqlite:///users.db', 'admin_password': 'admin', 'activity_log': 'activity.log', 'nodes': [<core.node.Node object at 0x7eff9df15810>, <core.node.Node object at 0x7eff9dbfb...
5月 25 10:26:41 localhost.localdomain python3[111963]: can't set attribute
5月 25 10:26:41 localhost.localdomain python3[111963]: * Serving Flask app "run" (lazy loading)
5月 25 10:26:41 localhost.localdomain python3[111963]: * Environment: production
5月 25 10:26:41 localhost.localdomain python3[111963]: WARNING: This is a development server. Do not use it in a production deployment.
5月 25 10:26:41 localhost.localdomain python3[111963]: Use a production WSGI server instead.
5月 25 10:26:41 localhost.localdomain python3[111963]: * Debug mode: off
5月 25 10:26:41 localhost.localdomain python3[111963]: * Running on all addresses.
5月 25 10:26:41 localhost.localdomain python3[111963]: WARNING: This is a development server. Do not use it in a production deployment.
5月 25 10:26:41 localhost.localdomain python3[111963]: * Running on http://192.168.93.128:5000/ (Press CTRL+C to quit)
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost cesi]# 

默认用户名:admin
密码:admin

登录一下,发现报错了


看报错日志 /var/log/message

May 25 10:28:39 localhost python3: [2021-05-25 10:28:39,728] ERROR in app: Exception on /api/v2/auth/login/ [POST]
May 25 10:28:39 localhost python3: Traceback (most recent call last):
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/sqlalchemy/util/_collections.py", line 1008, in __call__
May 25 10:28:39 localhost python3: return self.registry[key]
May 25 10:28:39 localhost python3: KeyError: <greenlet.greenlet object at 0x7eff9c981710 (otid=0x7eff9c6a0f00) current active started main>
May 25 10:28:39 localhost python3: During handling of the above exception, another exception occurred:
May 25 10:28:39 localhost python3: Traceback (most recent call last):
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
May 25 10:28:39 localhost python3: response = self.full_dispatch_request()
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
May 25 10:28:39 localhost python3: rv = self.handle_user_exception(e)
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
May 25 10:28:39 localhost python3: reraise(exc_type, exc_value, tb)
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
May 25 10:28:39 localhost python3: raise value
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
May 25 10:28:39 localhost python3: rv = self.dispatch_request()
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
May 25 10:28:39 localhost python3: return self.view_functions[rule.endpoint](**req.view_args)
May 25 10:28:39 localhost python3: File "/data/supervisor/cesi/cesi/api/v2/auth.py", line 35, in login
May 25 10:28:39 localhost python3: result = User.verify(user_credentials["username"], user_credentials["password"])
May 25 10:28:39 localhost python3: File "/data/supervisor/cesi/cesi/models.py", line 37, in verify
May 25 10:28:39 localhost python3: user = User.query.filter_by(username=username).first()
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 514, in __get__
May 25 10:28:39 localhost python3: return type.query_class(mapper, session=self.sa.session())
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/sqlalchemy/orm/scoping.py", line 129, in __call__
May 25 10:28:39 localhost python3: return self.registry()
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/sqlalchemy/util/_collections.py", line 1010, in __call__
May 25 10:28:39 localhost python3: return self.registry.setdefault(key, self.createfunc())
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 4065, in __call__
May 25 10:28:39 localhost python3: return self.class_(**local_kw)
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 138, in __init__
May 25 10:28:39 localhost python3: bind = options.pop('bind', None) or db.engine
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 943, in engine
May 25 10:28:39 localhost python3: return self.get_engine()
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 962, in get_engine
May 25 10:28:39 localhost python3: return connector.get_engine()
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 555, in get_engine
May 25 10:28:39 localhost python3: options = self.get_options(sa_url, echo)
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 570, in get_options
May 25 10:28:39 localhost python3: self._sa.apply_driver_hacks(self._app, sa_url, options)
May 25 10:28:39 localhost python3: File "/data/supervisor/python3.7/lib/python3.7/site-packages/flask_sqlalchemy/__init__.py", line 914, in apply_driver_hacks
May 25 10:28:39 localhost python3: sa_url.database = os.path.join(app.root_path, sa_url.database)
May 25 10:28:39 localhost python3: AttributeError: can't set attribute

May 25 10:28:39 localhost python3: sa_url.database = os.path.join(app.root_path, sa_url.database)
May 25 10:28:39 localhost python3: AttributeError: can’t set attribute

解决方法

AttributeError:使用flask-sqlalchemy连接到sqlite数据库时无法设置属性

[root@localhost cesi]# /data/supervisor/python3.7/bin/pip3 install  --upgrade sqlalchemy==1.3.23
[root@localhost cesi]# systemctl restart cesi

OK,已经重启了,现在再登录一下

第二篇supervisor集群管理工具cesi安装详解-如何安装supervisor-cesiwebUI相关推荐

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

    第一篇supervisor集群管理工具cesi安装详解-如何安装supervisor 环境 准备 安装python3.7.4 问题 解决方法 安装supervisor 配置supervisor服务 启 ...

  2. 集群管理工具KafkaAdminClient——改造

    欢迎支持笔者新作:<深入理解Kafka:核心设计与实践原理>和<RabbitMQ实战指南>,同时欢迎关注笔者的微信公众号:朱小厮的博客. 欢迎跳转到本文的原文链接:https: ...

  3. docker集群管理工具_太多选择:如何选择正确的工具来管理Docker集群

    docker集群管理工具 There are all kinds of ways to play the Docker game and, obviously, no one of them is g ...

  4. ElasticSearch入门 第二篇:集群配置

    这是ElasticSearch 2.4 版本系列的第二篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...

  5. kafka集群管理工具kafka-manager

    一.kafka-manager简介 kafka-manager是目前最受欢迎的kafka集群管理工具,最早由雅虎开源,用户可以在Web界面执行一些简单的集群管理操作.具体支持以下内容: 管理多个集群 ...

  6. redis-manger集群管理工具

    redis-manger集群管理工具 源起 安装 优点 源起 缺少一个redis集群管理工具 安装 链接: github地址 优点 安装简单,功能够用

  7. Redis 集群搭建及集群管理工具

    目录 一.简介 二.架构图 三.搭建集群 3.1.下载 3.2.编译安装 3.3.配置文件修改 3.4.创建集群 四.集群管理工具redis-cli 4.1.查看集群信息 4.2.检查集群 4.3.修 ...

  8. Redis核心解读–集群管理工具(Redis-sentinel)

    Redis-sentinel是Redis实例的监控管理.通知和实例失效备援服务,是Redis集群的管理工具.在一般的分布式中心节点数据库中,Redis-sentinel的作用是中心节点的工作,监控各个 ...

  9. Docker swarm集群管理工具

    1. 简介 Docker Swarm 是Docker的集群管理工具,简单方便.易于上手. Swarm集群由以下两个组件构成: Mananger:负责整个集群的管理工作包括集群配置.服务管理等所有跟集群 ...

最新文章

  1. [记录]使用openGL显示点云的一个程序
  2. JS三种简单排序算法
  3. LiberOJ #6210. 「美团 CodeM 决赛」tree 树形DP
  4. 友盟分享快速集成--学习记录
  5. c#怎么设置一个字符串中某个字符的颜色
  6. laravel无法运行php,Laravel:php artisan服务无法启动
  7. 08 Javascript的函数
  8. android studio按键精灵,51模拟器怎么连接按键精灵 51安卓模拟器按键精灵连接教程...
  9. Hack the box靶机 Blunder
  10. QT报错 error: [debug/qrc_image.cpp] Error 1
  11. nuc977 linux i9341 2.8寸lcd配置
  12. 21计算机考研国家线,来了!21考研国家线公布!附详细解读!
  13. Android图片缓存框架 - Fresco的GenericDraweeHierarchy (五)
  14. 解决 TypeError: expected string or bytes-like object
  15. antd table 添加行,编辑行,删除行
  16. Scrapy去重操作
  17. php文字添加投影,视频加动态标题文字 视频标题文字添加阴影边框 给视频加上炫酷的文字标题...
  18. 图像基本操作——图像边界填充和图像融合
  19. Vue axios请求自带域名,接口及项目名
  20. 读文章笔记(八):多模态情感分析数据集整理

热门文章

  1. 扁平化风格博客——后续
  2. 随机梯度下降法概述与实例
  3. 用户计算机脱域了如何处理,AD域计算机经常脱域
  4. carte集群的搭建笔记
  5. 【APS】90张专业PPT学习高级计划与排程(APS)
  6. 【ICLR 2023】Diffusion Models扩散模型和Prompt Learning提示学习:prompt-to-prompt
  7. 《安富莱嵌入式周报》第221期:2021.07.12--2021.07.18
  8. C++:统计小写字母个数
  9. nested exception is io.lettuce.core.RedisCommandExecutionException: ERR invalid expire time in setex
  10. Anaconda——最省心的 Python 版本