2017-04-03 26 views
0

我正嘗試使用librbd和Python連接到我的Ceph集羣。如果我嘗試使用來自Ceph文檔的this示例,則會顯示一條錯誤消息,指出「連接到羣集的錯誤:錯誤代碼95」。看下面的代碼示例。如何使用librbd連接到Ceph集羣(Python)

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2 
Type "help", "copyright", "credits" or "license" for more information.  
>>> import rados 
>>> cluster = rados.Rados(conffile='/etc/ceph/ceph.conf') 
>>> cluster.connect() 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "rados.pyx", line 785, in rados.Rados.connect (/build/ceph-10.2.6/src/build/rados.c:10073) 
rados.Error: error connecting to the cluster: error code 95 

Ceph集羣啓動並健康(HEALTH_OK)。這個錯誤代碼是什麼意思,我能做些什麼來解決它?

回答

0

好的,我找到了一個解決方案。問題在於,只能由sudo用戶讀取012ff中的ceph客戶端密鑰ceph.client.admin.keyring。根據您的情況,您可以:

  • 更新文件權限

  • 運行過程中的須藤

  • 或當前用戶添加到sudoers文件

我解決了它通過更新文件權限。這允許客戶端節點上的所有用戶運行ceph命令:

$ sudo chmod 644 /etc/ceph/ceph.client.admin.keyring