基于zeromq和raft一致性算法的分布式协调框架。

chillaxd的Python项目详细描述


https://api.travis-ci.org/ylamgarchal/chillaxd.png

chillaxd是一个基于zeromq和raft一致性算法的python分布式协调框架。

关于raft的更多细节,您可以阅读斯坦福大学diego ongaro和john ousterhout的In Search of an Understandable Consensus Algorithm

实施的状态和优先级

  • 领导人选举[完成]
  • 内存中日志复制[完成]
  • 客户端与状态机的交互[进行中]
  • 日志持久性[待办事项]
  • 日志压缩[待办事项]
  • 群集成员资格更改[待办事项]

安装依赖项

$ sudo apt-get install python-pip python-dev python3.4-dev -y

从pypi安装chillaxd

$ pip install chillaxd

从源安装ChillaxD

$ git clone https://github.com/ylamgarchal/chillaxd.git

$ cd chillaxd

$ sudo python setup.py install

运行测试

$ cd chillaxd

$ tox

在同一台计算机上运行三节点群集

首先,打开四个控制台,三个第一控制台将打印服务器日志 而第四个用于运行客户机命令。

$ chillaxd –config-file ./chillaxd_1.conf

2014-12-28 18:44:19,252 :: INFO :: let’s chillax on ‘127.0.0.1:27001’…

$ chillaxd –config-file ./chillaxd_2.conf

2014-12-28 18:44:19,252 :: INFO :: let’s chillax on ‘127.0.0.1:27002’…

$ chillaxd –config-file ./chillaxd_3.conf

2014-12-28 18:44:19,252 :: INFO :: let’s chillax on ‘127.0.0.1:27003’…

现在集群已经启动并运行。日志显示当前的 领袖。让我们试着发送一些命令。

例如,如果当前的leader是监听端口27001的leader。

警告:目前,它是演示复制机制的最低限度客户机。

$ export CHILLAXD_SERVER=127.0.0.1:27001

$ chillax create_node /node_1 data_1

ACK command ‘c154482f-1ba7-4d0c-b8a4-b54d3807e2a2’

我们在根“/”命名“node_1”上创建了一个与数据“data_1”关联的节点,我们 然后可以验证是否在每个服务器上复制了此命令。

$ export CHILLAXD_SERVER=127.0.0.1:27001

$ chillax 127.0.0.1:27001 get_children /

[‘node_1’]

$ export CHILLAXD_SERVER=127.0.0.1:27002

$ chillax 127.0.0.1:27002 get_children /

[‘node_1’]

$ export CHILLAXD_SERVER=127.0.0.1:27003

$ chillax 127.0.0.1:27003 get_children /

[‘node_1’]

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

推荐PyPI第三方库


热门话题
java如何使用Ibatis在插入时返回ID(使用返回关键字)   java(org.hibernate.TransactionException)org。冬眠TransactionException:事务未成功启动   java小程序jwindow始终位于JNLP顶部   在Java中重新解析JSON对象?   java单击后将ListView数据移动到新屏幕   Mule ESB中的java WSA寻址特性   Java,对象编程:获取返回0值的方法   hibernate的Java通用问题,如何处理T get(K id)   java在使用超级CSV读取CSV时忽略引用   ssh使用Java远程运行命令   java如何向具体用户发送websocket消息?   在JAVA中,我可以在不指定的情况下使用条件运算符吗?