简体   繁体   English

elasticsearch-无法通过curl访问localhost:9200

[英]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.

相关问题 elasticsearch-head 无法使用 http://localhost:9200 连接到 elasticsearch - elasticsearch-head can't connection to elasticsearch with http://localhost:9200 为什么 Elasticsearch 无法连接到 LocalHost:9200? - Why Doesn't Elasticsearch connect to LocalHost:9200? Elasticsearch 错误 curl: (7) Failed to connect to localhost port 9200: Connection denied but localhost:9200 在浏览器上工作 - Elasticsearch error curl: (7) Failed to connect to localhost port 9200: Connection refused but localhost:9200 works on browser ElasticSearch安装错误 - 卷曲:(7)连接到localhost失败:9200; 拒绝连接 - ElasticSearch installation error - curl: (7) Failed connect to localhost:9200; Connection refused 奇怪的{“OK”:{}}响应ElasticSearch curl -X GET'http:// localhost:9200' - strange {“OK”:{}} response on ElasticSearch curl -X GET 'http://localhost:9200' ElasticSearch错误-curl:(7)无法连接到localhost:9200; 拒绝连接 - ElasticSearch error - curl: (7) Failed connect to localhost:9200; Connection refused 如何使elasticsearch可通过localhost访问:9200 - How to make elasticsearch embedded accessible via localhost:9200 无法在Ubuntu上的9200中连接Elasticsearch - Can't Connect Elasticsearch in 9200 on Ubuntu 无法通过浏览器使用 http://localhost:9200、9201、9203 访问 elasticsearch 集群中的 3 个节点中的 2 个(仅第一个)。这是否正常,为什么? - Cannot access to 2 of 3 nodes in elasticsearch cluster (only first) via browser with http://localhost:9200, 9201, 9203. Is this normal and why? Elasticsearch-“ http:// localhost:9200 /?pretty”在IE中不起作用-不是吗? - Elasticsearch - “http://localhost:9200/?pretty” Not Working in IE - Shouldn't it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM