对称性——一种微型集群的集群管理系统

mc2-symmetr的Python项目详细描述


对称性

MC2的群集管理工具。

构建

要创建虚拟环境并安装需求,请运行(默认情况下,它使用python3.7,您可以更改 在Makefile变量中VENV_BIN

make venv

建立docker映像(可能需要sudo

make docker-build-all

与Docker运行对称性

用集群中的信息填充etc/nodes.ini。 然后可以使用

启动应用程序
make start

并将浏览器指向http://localhost:5000/ui/dashboard

停止使用

make stop

两个命令都在docker/symmetry/docker-compose.yml上使用docker-compose,可能需要sudo

手动运行对称组件

先决条件

确保virtualenv已激活

source .venv/bin/activate

symmetry向redis发布和读取遥测数据, 所以您首先需要一个正在运行的redis实例:

redis-server

启动遥测deamon

通过

python -m symmetry.cli.telemd

telemd还接受各种参数来控制运行时方面(激活-h标志)。 例如,要每0.5秒禁用电源监视和探测节点,请运行

python -m symmetry.cli.telemd --power-disable --agent-interval=.5

您可以通过支持主题来验证遥测守护程序是否发送数据 通过redis cli:

redis-cli psubscribe "telemetry:*"

启动群集deamon

启动群集守护程序(控制群集状态)

python -m symmetry.cli.clusterd

websocket服务器

启动仪表板的WebSocket服务器:

python -m symmetry.cli.websocket

websocket正在端口8082上运行,并自动连接到localhost:6379上的本地redis服务器。 与ws://ip:8082/topic连接以接收给定topic的所有已发布消息。

运行仪表板

为应用程序提供Gunicorn

gunicorn -w 4 --preload -b 0.0.0.0:5000 \
    -c symmetry/webapp/gunicorn.conf.py \
    symmetry.webapp.wsgi:api

将浏览器指向http://localhost:5000/ui/dashboard

使用对称性

创建服务

若要在群集中创建新服务,必须将请求发送到 api/services/{service_id}端点,service_id是新服务。

POST请求有一个可选的 (tar-exported docker image)和一个强制(服务 说明)主体元素。

服务描述的结构如下:

%YAML1.2---id:#must be same id as in endpointmaintainer:#the uploader of the servicename:#"Pretty" version of the nameversion:#any version numberdescription:#simple descriptionimage_tag:#if docker image uploaded then this tag must be provided by the image. otherwise it is pulled port:#the port which is exposed by the service

正确执行后,答案应该如下:

{"name":"Test Service","version":"1.0.0","desc":"This is a simple test_service","maintainer":"silvio","10.0.0.3":"1"}

其他客户端脚本

记录遥测数据

您可以使用遥测客户端cli.telemc在 各种方式。

# prints to system out
python -m symmetry.cli.telemc

# writes to a csv file
python -m symmetry.cli.telemc --file /tmp/telemetry-results.csv

Arduino功率计

要每隔0.5秒从Arduino电源监视器中采样瓦特数,请致电:

python -m symmetry.cli.power --interval 0.5

这会像遥测守护进程一样将数据写入redis实例。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
swing Java按钮/网格布局   java列出Google日历中的所有事件   java无效:单击API publisher test按钮后连接到后端时出错   带有内部赋值的java While循环导致checkstyle错误   java为什么trimToSize/ensureCapacity方法提供“公共”级访问?   文件输出流的java问题   ListIterator和并发修改异常的java问题   java如何使用两个URL映射   无法识别使用“./../”构造的字符串java相对路径,为什么?   首次写入remotelyclosedsocket不会触发异常,对吗?JAVA   java OneDrive REST API为文件上载提供了400个无效谓词   Java泛型、集合接口和对象类的问题   OpenSSL Java安全提供程序   jmeter java运行jmx禁用操作