2016-03-28 49 views
0

我有本地系统中运行的本地mesos设置(playa mesos)。我有一个需求,我需要分析来自不同从站的资源提供,还需要从mesos群集节点(主站和从站)获取调度信息。如何访问mesos http端点以获取集群信息

我正在尝试使用curl打击mesos文档中提到的HTTP端点并尝试获取信息。

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端点与调度,作业执行等无关。当我试图用curl访问它们时,它根本无法工作,也没有返回任何json数据。

我需要帮助来制作所有可用的resurces的mesos http端点woking。我正在尝试关注mesos文档,但没有运气。如果有人能发布示例curl命令,它将会很棒。谢谢

+0

你找哪家HTTP状态代码(2XX,3XX,4XX,5XX)?我只是在0.28 Mesos集群上试过你的curl命令,它工作正常。 –

+0

等等,现在这是两个完全不同的问题。 IDK什么是Java的问题是没有上下文,但在/健康的情况下,这是预期的行为 - 返回200,请阅读文档: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

我相信你的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":[]}% 
相关问题