Skip to main content

raft python实现, 用于测试学习

Project description

说明

非拜占庭节点的分布式共识算法Raft的python实现。

Raft官网:https://raft.github.io/

raft

整体架构

文件说明

  • node.py, log.py为raft核心代码
  • node.py 实现raft的节点消息收发、角色转换等功能
  • log.py 实现具体的日志存储
  • rpc.py 实现具体消息编码和转发
  • master.py 控制面中心节点, 进行group创建和管理
  • slave.py 每个server上部署的控制面节点

test

环境:windows 10系统 单机

测试步骤

  1. 运行 python -m raft.master, 启动master节点
  2. 运行 python -m raft.slave, 启动slave节点
  3. 运行 python -m test.test_master param
    • param: create_group, create一个raft group
    • param: stop_group, 安全终止 一个raft group
    • param: stop_master, 安全终止master
  4. 运行 python -m test.test_slave param
    • param: stop_slave, 安全终止slave
  5. 运行 python -m test.client, 用户写入log

结果说明

  • data/master, master存储的数据
  • data/slvae, slave存储的数据
  • data/node
    • .log 各node交互过程监控数据, 可以在git bash中用tail -f filename.log查看
    • persistent.json, node持久化数据
    • log.json, 存储的日志

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raft-python-0.1.3.tar.gz (10.6 kB view details)

Uploaded Source

File details

Details for the file raft-python-0.1.3.tar.gz.

File metadata

  • Download URL: raft-python-0.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for raft-python-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b584b2d37daf0d50ad88690ee0cd31ee05ee41bec26854215853ff8f53266001
MD5 95651efbca2c575b63273cba90f53f32
BLAKE2b-256 84ab1b86e6bd2bb6d492c71b6d3e92e61249f51db66108b4cf3483238f80b732

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page