我相信你的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":[]}%
你找哪家HTTP状态代码(2XX,3XX,4XX,5XX)?我只是在0.28 Mesos集群上试过你的curl命令,它工作正常。 –
等等,现在这是两个完全不同的问题。 IDK什么是Java的问题是没有上下文,但在/健康的情况下,这是预期的行为 - 返回200,请阅读文档:http://mesos.apache.org/documentation/latest/endpoints/master/health/ –
从java代码尝试时,我得到的一般是4XX。但“curl -header”Content-Type:application/json“--header”Accept:application/json“:5050/master/health”; url只是没有返回任何命令提示符。 –
psaha4