Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/george551556/distributed_control
The distributed computing task based on the gin framework and websocket. Aims to calculate whether there is a string whose MD5 value is equal to itself
https://github.com/george551556/distributed_control
distributed distributed-systems gin golang http md5 websocket
Last synced: about 1 month ago
JSON representation
The distributed computing task based on the gin framework and websocket. Aims to calculate whether there is a string whose MD5 value is equal to itself
- Host: GitHub
- URL: https://github.com/george551556/distributed_control
- Owner: George551556
- Created: 2024-08-16T15:17:16.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-10-01T12:27:33.000Z (about 1 month ago)
- Last Synced: 2024-10-15T19:22:22.855Z (about 1 month ago)
- Topics: distributed, distributed-systems, gin, golang, http, md5, websocket
- Language: Go
- Homepage:
- Size: 84.2 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 分布式中央集权MD5计算
### 简介
分为master和worker节点,master负责接收worker的连接请求以及心跳信息,向worker发送开始/停止工作的命令,节点之间通过gin构建的后端程序以及发送http请求来通信。同时返回前端页面实现网页控制以及所有worker节点的信息查看。worker
### 思路
- worker在未连接状态下持续(每2s)向主节点发送连接请求,目标地址端口在*config.json*文件中保存并使用viper读取
- worker连接成功后持续获取本机的CPU信息并向主机心跳信息用于保持连接状态不丢失
- master持续检测工人的心跳,如果有某个心跳超过10s未更新则关闭与其的连接
- 添加批量启动或停止的按钮,一次性控制所有节点。### 改为socket通信
- 工人向主机发送消息的type=1,心跳信息
- 工人向主机发送消息的type=2,计算结果及值
- 主机向工人发送消息的type=3,开始或停止工作
- 主机向工人发送消息的type=4,清零工作量值### 使用说明
- 启动master节点,后加参数0即可,示例:
```bash
./run_win.exe 0
./run_linux 0
```- 启动worker节点
1. 首先在根目录下创建`config.json`文件,格式如下:
> host为要远程连接的主机的地址和端口,name给本机一个让人易明白的名字
```json
{
"host_address":"lzh.zzdx.gay",
"host_port":55156,
"name":"张三的XX机"
}
```
2. 直接执行命令,不加任何参数
```bash
./run_win.exe
./run_linux# 或者后台运行
nohup ./run-linux 2>&1 &
```