2016-07-01 8 views
1

「CEPH」それは、CLIから問題なく動作します指定された一般のCEPHクラスタ上CEPH-残り-APIを実行しようとしている:私はしようとすると、CEPH-残り-API

/bin/ceph-rest-api --cluster ceph --id admin 
    * Running on http://0.0.0.0:5000/ 

しかし、名前のテストクラスタ上で実行し、「テスト」それエラーアウト:

/bin/ceph-rest-api --cluster test --name test 
Traceback (most recent call last): 
    File "/bin/ceph-rest-api", line 59, in <module> 
    rest, 
    File "/usr/lib/python2.7/site-packages/ceph_rest_api.py", line 495, in generate_app 
    addr, port = api_setup(app, conf, cluster, clientname, clientid, args) 
    File "/usr/lib/python2.7/site-packages/ceph_rest_api.py", line 104, in api_setup 
    app.ceph_cluster = rados.Rados(name=clientname, conffile=conf) 
    File "rados.pyx", line 525, in rados.Rados.__init__ (rados.c:5719) 
    File "rados.pyx", line 425, in rados.requires.wrapper.validate_func (rados.c:4106) 
    File "rados.pyx", line 557, in rados.Rados.__setup (rados.c:6237) 
rados.Error: rados_initialize failed with error code: -22 

:私もバリエーションを使用してみましたし、別のエラーを持っている

/bin/ceph-rest-api --cluster test --id test 
Traceback (most recent call last): 
    File "/bin/ceph-rest-api", line 59, in <module> 
    rest, 
    File "/usr/lib/python2.7/site-packages/ceph_rest_api.py", line 495, in generate_app 
    addr, port = api_setup(app, conf, cluster, clientname, clientid, args) 
    File "/usr/lib/python2.7/site-packages/ceph_rest_api.py", line 106, in api_setup 
    app.ceph_cluster.connect() 
    File "rados.pyx", line 785, in rados.Rados.connect (rados.c:8969) 
rados.ObjectNotFound: error connecting to the cluster 

私が間違っていることについての助けがあれば、大歓迎です。

答えて

0

rados.ObjectNotFound: error connecting to the cluster/bin/ceph-rest-api --cluster test --id testは、テストユーザーが存在しないことを意味します。また、ceph-rest-apiのマニュアルページによれば、--nameはクライアントで始まり、 - idはクライアントなしで始まります。 すなわち: ceph-rest-api --cluster test --name client.admin または ceph-rest-api --cluster test --id admin

0

あなたはCEPH-残り-APIが開始されなければならないマシン上のキーリングファイルを配置する必要があります。

  1. restapiのユーザーを作成します。
    ceph auth get-or-create client.rest-test mds 'allow' osd 'allow *' mon 'allow *

    出力はこの
    [client.rest-test] key = AQDPVTFZsiZjIRAAtLXWWlr8Q8t1PjhFKnOCyw==

  2. のようになります/etc/ceph/ceph-client.<username>.keyring
    残りのユーザーキーリングファイルを作成し、そのファイルにceph auth get-or-createからの出力を貼り付けたり、コマンドを実行するときに出力をリダイレクトします。
    あなたは常に、ユーザーがすでに作成されたコマンドceph auth get-or-createを、繰り返すことができ、CEPH払いは同じように、ユーザのキーウント名を取得します


  3. ceph-rest-api --name client.rest-test
    または
  4. 開始CEPH-残り-API ceph-rest-api --id rest-test

研究

私はstraceの持ついくつかのテストがfiguしました開始する前にceph-rest-apiが開いているファイルと読み込んでいるファイルを取り出してください。
strace -e open ceph-rest-api -i rest-test 2>&1 | grep key

... 
open("/etc/ceph/ceph.client.rest-test.keyring", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/etc/ceph/ceph.keyring", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/etc/ceph/keyring", O_RDONLY)  = -1 ENOENT (No such file or directory) 
open("/etc/ceph/keyring.bin", O_RDONLY) = -1 ENOENT (No such file or directory) 

あなたが見ることができるように、CEPH-残り-APIは、いくつかの異なるキーファイルを開こうとすると、この場合には何のキーファイルが存在し、CEPH-残り-APIが失敗した開始されません。 あなたの残りのユーザーを表す正しいキーファイルを/ etc/cephに置くと、ファイルが読み込まれ、残りの-apiが起動します。

strace -e open,connect ceph-rest-api -i rest-test 2>&1 | grep -i 'key\|running' 
open("/etc/ceph/ceph.client.rest-test.keyring", O_RDONLY) = 3 
open("/etc/ceph/ceph.client.rest-test.keyring", O_RDONLY) = 3 
* Running on http://0.0.0.0:5000/