如何访问mesos http端点以获取群集信息

时间:2016-03-28 17:38:01

标签: curl mesos

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

我正在尝试使用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端点。我正在尝试关注mesos文档,但没有运气。如果有人可以发布示例curl命令工作,那将会很棒。谢谢

1 个答案:

答案 0 :(得分:2)

我相信你的卷曲命令会打击&#34; / health&#34;端点工作正常;你在命令行看不到任何东西,因为200 OK响应没有正文。要查看响应标头,请使用curl的-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":"master@127.0.0.1:5050","hostname":"localhost","activated_slaves":0.0,"deactivated_slaves":0.0,"leader":"master@127.0.0.1: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":[]}%