跳转到主要内容

对称性 - 微集群集群管理系统

项目描述

symmetry

MC2的集群管理工具。

构建

要创建虚拟环境和安装依赖项,请运行(默认使用python3.7,您可以在Makefile变量VENV_BIN中更改它)

make venv

手动运行对称性组件

先决条件

确保已激活虚拟环境

source .venv/bin/activate

对称性将遥测数据发布到redis并从中读取,因此您首先需要一个正在运行的redis实例

redis-server

启动遥测守护进程

下载并启动遥测守护进程

./telemd

您可以通过通过redis CLI订阅主题来验证遥测守护进程是否发送数据

redis-cli psubscribe "telem/*"

启动集群守护进程

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

python -m symmetry.cli.clusterd

WebSocket服务器

要启动仪表板用的WebSocket服务器

python -m symmetry.cli.websocket

WebSocket运行在端口8082上,并自动连接到本地的redis-server localhost:6379。使用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}端点发送一个POST请求,其中service_id是新的服务。

POST请求有一个可选的(tar导出的docker镜像)和一个必须的(服务描述)正文元素。

服务描述结构如下

%YAML 1.2
---
id: #must be same id as in endpoint
maintainer: #the uploader of the service
name: #"Pretty" version of the name
version: #any version number
description: #simple description
image_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

项目细节


下载文件

下载适合您平台的文件。如果您不确定该选择哪一个,请了解更多关于安装包的信息。

源代码发行版

mc2-symmetry-0.6.0.tar.gz (41.0 kB 查看哈希值)

上传时间 源代码

构建发行版

mc2_symmetry-0.6.0-py3-none-any.whl (61.8 kB 查看哈希值)

上传时间 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面