2021-05-12 14:32:11
Zookeeper的Python用戶端安裝
專案中使用了Python,需要使用到Zookeeper的功能,這裡記錄一下安裝過程。
核心版本:2.6.32
發行版:CentOS-6.6 64bit
1、由於python用戶端依賴c的用戶端所以要先安裝c版本的用戶端
[root@rocket c]# cd /usr/local/zookeeper-3.4.6/src/c
[root@rocket c]# ./configure
[root@rocket c]# make
[root@rocket c]# make install
2、測試c用戶端
看到以上資訊說明c版本的用戶端已經安裝好了,下面安裝python版本用戶端
3、下載python擴充套件包,並且解壓
[root@rocket local]wget https://pypi.python.org/pypi/zkpython/0.4.2
[root@rocket local]# tar -zxvf zkpython-0.4.2.tar.gz
如果找不到Python.h,可能由於沒有安裝python-devel
[root@rocket zkpython-0.4.2]# yum -y install python-devel
4、測試是否成功
[root@rocket zookeeper]# cat zk_test.py
import zookeeper
[root@rocket zookeeper]# python zk_test.py
提示找不到libzookeeper_mt.so.2,將libzookeeper_mt.so.2的路徑加入到LD_LIBRARY_PATH中
[root@rocket zookeeper]# python zk_test.py
Traceback (most recent call last):
File "zk_test.py", line 1, in <module>
import zookeeper
File "build/bdist.linux-x86_64/egg/zookeeper.py", line 7, in <module>
File "build/bdist.linux-x86_64/egg/zookeeper.py", line 6, in __bootstrap__
ImportError: libzookeeper_mt.so.2: cannot open shared object file: No such file or directory
[root@rocket zookeeper]# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
再次測試
[root@rocket zookeeper]# python zk_test.py
沒報錯,說明已經成功安裝。
--------------------------------------分割線 --------------------------------------
Ubuntu 14.04安裝分散式儲存Sheepdog+ZooKeeper http://www.linuxidc.com/Linux/2014-12/110352.htm
CentOS 6安裝sheepdog 虛擬機器分散式儲存 http://www.linuxidc.com/Linux/2013-08/89109.htm
ZooKeeper叢集設定 http://www.linuxidc.com/Linux/2013-06/86348.htm
使用ZooKeeper實現分散式共用鎖 http://www.linuxidc.com/Linux/2013-06/85550.htm
分散式服務架構 ZooKeeper -- 管理分散式環境中的資料 http://www.linuxidc.com/Linux/2013-06/85549.htm
ZooKeeper叢集環境搭建實踐 http://www.linuxidc.com/Linux/2013-04/83562.htm
ZooKeeper伺服器叢集環境設定實測 http://www.linuxidc.com/Linux/2013-04/83559.htm
ZooKeeper叢集安裝 http://www.linuxidc.com/Linux/2012-10/72906.htm
Zookeeper3.4.6的安裝 http://www.linuxidc.com/Linux/2015-05/117697.htm
--------------------------------------分割線 --------------------------------------
本文永久更新連結地址:http://www.linuxidc.com/Linux/2016-01/127429.htm
相關文章