09 Aug 2017
确保安装了python-2.7.13和git
参照文档python-etcd
git clone https://github.com/jplana/python-etcd.git
cd python-etcd/
python setup.py install
import etcd client = etcd.Client(host='192.168.33.41', port=2379) # for etcd cluster # client = etcd.Client(host=(('127.0.0.1', 4001), ('127.0.0.1', 4002), ('127.0.0.1', 4003))) client.write('/nodes/n1', 1)
更多更新etcd值方法和参数,参照python-etcd
client.read('/nodes/n2').value client.read('/nodes', recursive = True) #get all the values of a directory, recursively.
更多读取etcd值方法和参数,参照python-etcd