[英]elasticsearch - can't access localhost:9200 via curl
I start elasticsearch
server and want to access localhost:9200
via curl. 我启动elasticsearch
服务器,并希望通过curl访问localhost:9200
。
Here is my try: 这是我的尝试:
curl -u elastic:H5VzhJP0txg4Lm9EMSZp localhost:9200
curl -u elastic:H5VzhJP0txg4Lm9EMSZp http://localhost:9200
curl -u elastic:H5VzhJP0txg4Lm9EMSZp http://127.0.0.1:9200
curl -XGET -u elastic:H5VzhJP0txg4Lm9EMSZp http://localhost:9200
curl -XGET -u elastic:H5VzhJP0txg4Lm9EMSZp -H 'Content-Type: application/json' 'http://localhost:9200'
All of them give me the result: curl: (52) Empty reply from server
他们全都给了我结果: curl: (52) Empty reply from server
But, I can access localhost:9200
via browser. 但是,我可以通过浏览器访问localhost:9200
。
here is my elasticsearch
version: 这是我的elasticsearch
版本:
☁ kibana-research [master] ⚡ elasticsearch --version
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to No such file or directory
Version: 6.2.4, Build: ccec39f/2018-04-12T20:37:28.497551Z, JVM: 1.8.0_171
I think the reason is the proxy
我认为原因是proxy
Here is my config in ~/.zshrc
file 这是我在~/.zshrc
文件中的配置
98 # proxy list
99 alias proxy='export all_proxy=socks5://127.0.0.1:1086'
100 alias unproxy='unset all_proxy'
when I run unproxy
in terminal, that means I don't use proxy server. 当我在终端中运行unproxy
时,这意味着我不使用代理服务器。
Then, it works fine. 然后,它工作正常。
☁ kibana-research [master] ⚡ curl -u elastic:H5VzhJP0txg4Lm9EMSZp localhost:9200
{
"name" : "KBgeNNv",
"cluster_name" : "elasticsearch_ldu020",
"cluster_uuid" : "Src22ahwTYy9jVthB8w0DQ",
"version" : {
"number" : "6.2.4",
"build_hash" : "ccec39f",
"build_date" : "2018-04-12T20:37:28.497551Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
Try this. 尝试这个。
curl 'username:password@localhost:9200'
curl 'username:password@localhost:9200' -H 'Content-Type: application/json'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.