ZooKeeper的四个字母命令包装器和网络监视器。
zookeeper_monitor的Python项目详细描述
模块允许您通过tcp-https://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html#sc_zkCommands调用zookeeper命令-四个字母的命令。它还内置了网络监视器。基于Tornado,兼容Python2.7.x、3.x及以上版本。它不需要zookeeper,也不需要zookeeper的头(因为它不使用zkpython)。
安装
它可以从pypi安装,也可以直接从git存储库安装。
pip install zookeeper_monitor #or git clone https://github.com/kwarunek/zookeeper_monitor.git cd zookeeper_monitor/ python setup.py install
用法
示例:
fromzookeeper_monitorimportzk@tornado.gen.coroutinedefsome_coroutine()host=zk.Host('zookeeper.addr.ip',2181)# you can run each command as a coroutine example:# get srvr datasrvr_data=yieldhost.srvr()# get stat datastat_data=yieldhost.stat()# get server stateruok=yieldhost.ruok()# stop zookeeperyieldhost.kill()
如果不使用TORNADO,可以将其包装为同步代码
fromtornado.ioloopimportIOLoopIOLoop.instance().run_sync(some_coroutine)
网络监视器
要运行web监视器,需要提供配置,如果不提供配置,默认情况下将使用localhost:2181。
python -m zookeeper_monitor.web # with configuration file python -m zookeeper_monitor.web -c /somepath/cluster.json # to see available options python -m zookeeper_monitor.web --help
接下来导航到http://127.0.0.1:8080/(或指定的任何内容)。
配置
定义clustercluster.json(json或yaml)
{"name":"brand-new-zookeeper-cluster","hosts":[{"addr":"10.1.15.1","port":2181,"dc":"eu-west"},{"addr":"10.2.31.2","port":2181,"dc":"us-east"},{"addr":"10.1.12.3","port":2181,"dc":"eu-west"}]}
- 名称(字符串)-群集名称。
- 主机(列表)-运行群集中连接的ZooKeeper的主机列表:
- 地址(字符串):IP或域,必需
- 端口(int):zookeeper端口,可选,默认2181
- DC(字符串):数据中心/位置名称,可选
许可证
麻省理工学院
待办事项
- 更多测试
- webmonitor中的更多统计信息
- 分析zookeeper版本
- ZooKeeper 3.3和3.4中的新命令
- 解析转储的输出,reqs
更改日志
0.3.0-实现mntr,贷记到Robb Wagoner
0.2.5-使用“超时”实现,处理程序获取模板,主机中的py3.3 gen.任务,css颜色
0.2.4-单独的getter模板/静态目录
0.2.3-修复PY3 Web中的导入
0.2.2-清理:pylint、readme、分类器
0.2.1-修复包,修复测试
0.2.0-执行更多命令,更新文档
0.1.2-release-pypi
0.1.1-清理
0.1.0-公共独立
0.0.3-0.0.9-重构,测试
0.0.2-工作吃水
0.0.1-初始概念