2016-03-28 17 views
0

ローカルシステムで実行されているローカルmesos設定(playa mesos)があります。私は、異なるスレーブからのリソース提供を分析する必要があり、また、メソスのクラスターノード(マスターとスレーブ)からスケジューリング情報を取得する必要があるという要件があります。クラスタ情報を取得するためにmesos httpエンドポイントにアクセスする方法

私は、mesosのドキュメントに記載されているようにHTTPエンドポイントにヒットするためにcurlを使用して情報を取得しようとしています。

curl --no-buffer -X POST -H "Content-Type: application/json" --data '{"type":"SUBSCRIBE","subscribe":{"framework_info":{"user":"root","name":"democurl"}}}' http://<ip address>:5050/master/api/v1/scheduler 

異なるスレーブからの提供を返します。 スケジューリングやジョブの実行などに関連するHTTPエンドポイントが多数ありますが、これらは動作しません。私がカールでそれらにアクセスしようとしているとき、それは単に動作しておらず、どんなjsonデータも戻さない。

私は、利用可能なすべてのレスキューのために、httpエンドポイントを作成するのに役立つ必要があります。私はmesosのドキュメントに従ってみたいと思っていますが、まだ幸運はありません。ありがとう

+0

あなたはどのHTTPステータスコードを取得します(2XX、3XX、4XX、5xxの)?私はあなたのcurlコマンドを0.28 Mesosクラスターで試したところ、うまくいきました。 –

+0

ハングして、これらはまったく異なる2つの質問です。 IDKのJavaの問題はコンテキストなしであるが、/ healthの場合はこれが予想される動作であるため、200を返すには、docs:http://mesos.apache.org/documentation/latest/endpoints/master/health/ –

+0

私は一般的にJavaコードから試してみると4XXを得ています。 "curl --header" Content-Type:application/json "--header" Accept:application/json ":5050/master/health"; urlはコマンドプロンプトで何も返さないだけです。 – psaha4

答えて

2

「/ health」エンドポイントに当たったcurlコマンドが正常に動作していると思います。 200 OK応答には本文がないため、コマンドラインに何も表示されません。同様レスポンスヘッダを参照するには、カールと-iオプションを使用します。

~/src/mesos/build|master⚡ curl -i --header "Content-Type: application/json" --header "Accept: application/json" -X GET localhost:5050/master/health 
HTTP/1.1 200 OK 
Date: Wed, 30 Mar 2016 19:15:45 GMT 
Content-Length: 0 

~/src/mesos/build|master⚡ curl -i --header "Content-Type: application/json" --header "Accept: application/json" -X GET localhost:5050/master/state 
HTTP/1.1 200 OK 
Date: Wed, 30 Mar 2016 19:16:54 GMT 
Content-Type: application/json 
Content-Length: 1504 

{"version":"0.29.0","git_sha":"3b8ddc87e6fb7fe3c02147f30d9bacbc9d17bb14","git_branch":"refs\/heads\/master","build_date":"2016-03-28 13:59:44","build_time":1459198784.0,"build_user":"user","start_time":1459365180.7711,"elected_time":1459365180.78308,"id":"ed84d3b1-4153-4177-b96b-8a11be5d4959","pid":"[email protected]:5050","hostname":"localhost","activated_slaves":0.0,"deactivated_slaves":0.0,"leader":"[email protected]:5050","flags":{"allocation_interval":"1secs","allocator":"HierarchicalDRF","authenticate":"false","authenticate_http":"false","authenticate_slaves":"false","authenticators":"crammd5","authorizers":"local","framework_sorter":"drf","help":"false","hostname_lookup":"true","http_authenticators":"basic","initialize_driver_logging":"true","ip":"127.0.0.1","log_auto_initialize":"true","logbufsecs":"0","logging_level":"INFO","max_completed_frameworks":"50","max_completed_tasks_per_framework":"1000","max_slave_ping_timeouts":"5","port":"5050","quiet":"false","recovery_slave_removal_limit":"100%","registry":"replicated_log","registry_fetch_timeout":"1mins","registry_store_timeout":"20secs","registry_strict":"false","root_submissions":"true","slave_ping_timeout":"15secs","slave_reregister_timeout":"10mins","user_sorter":"drf","version":"false","webui_dir":"\/Users\/gmann\/src\/mesos\/build\/..\/src\/webui","work_dir":"\/Users\/gmann\/var\/mesos","zk_session_timeout":"10secs"},"slaves":[],"frameworks":[],"completed_frameworks":[],"orphan_tasks":[],"unregistered_frameworks":[]}% 
関連する問題