我使用单个实例进行领事。一切正常,web-ui,ACL等。但是当我尝试使用curl
命令在本地访问所有键值时,响应为404 not found
,即使键值已经存在且可以在web-ui
中可以看到。
Config.json
档案
{
"bootstrap": true,
"server": true,
"log_level": "DEBUG",
"enable_syslog": true,
"datacenter": "dc1",
"addresses" : {
"http": "P.P.P.P"
},
"bind_addr": "P.P.P.P",
"node_name": "P.P.P.P",
"data_dir": "/home/ubuntu/consuldata",
"ui_dir": "~/dist",
"acl_datacenter": "dc1",
"acl_master_token": "xxxxxxxxxxxxxxxxxxxxx",
"acl_default_policy": "deny",
"encrypt": "pXoaLOJ816mO+da8y8zrsg=="
}
其中P.P.P.P
是私有IP,xxxxxxxxxxxxxxxxxxx
是master token
。
我已通过以下命令开始领事
consul agent -config-dir ~/server -ui-dir ~/dist -bootstrap true -client=P.P.P.P
运行此操作后,web-ui
工作正常,我可以创建ACL
和key-value
现在我试图通过以下命令获取所有键值对
curl -v http://P.P.P.P:8500/v1/kv/?recurse
以下是输出
* Hostname was NOT found in DNS cache
* Trying P.P.P.P...
* Connected to P.P.P.P (P.P.P.P) port 8500 (#0)
> GET /v1/kv/?recurse HTTP/1.1
> User-Agent: curl/7.35.0
> Host: P.P.P.P:8500
> Accept: */*
>
< HTTP/1.1 404 Not Found
< X-Consul-Index: 488
< X-Consul-Knownleader: true
< X-Consul-Lastcontact: 0
< Date: Tue, 10 May 2016 13:08:44 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host P.P.P.P left intact
其中P.P.P.P
是consul实例的私有IP。
以下是netstat -tlpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:8600 0.0.0.0:* LISTEN 1339/consul
tcp 0 0 P.P.P.P:8300 0.0.0.0:* LISTEN 1339/consul
tcp 0 0 P.P.P.P:8301 0.0.0.0:* LISTEN 1339/consul
tcp 0 0 P.P.P.P:8302 0.0.0.0:* LISTEN 1339/consul
tcp 0 0 127.0.0.1:8400 0.0.0.0:* LISTEN 1339/consul
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 P.P.P.P:8500 0.0.0.0:* LISTEN 1339/consul
tcp6 0 0 :::22 :::* LISTEN -
我已经在这些地址上尝试了curl
命令,而这些地址的领事正在收听,但却收到同样的错误。