Elasticsearch通过SSH远程访问

use*_*851 1 ssh elasticsearch

关于Elasticsearch HTTP API,我想知道我是否想远程访问SSH服务器上的集群,我应该在http rest命令中包含哪些内容:

    curl -XGET ' http://localhost:9200/ index /_mapping/ type ' 
Run Code Online (Sandbox Code Playgroud)

我尝试了类似下面的东西,但失败了:

    curl -XGET -u cloud-user: --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub  'xx.xxx.xxx.xxx:9200/index/_mapping/type'
Run Code Online (Sandbox Code Playgroud)

有没有人知道正确的命令或替代解决方案?

Thi*_*edo 8

如果你在*NIX环境中很容易,只需通过ssh隧道

ssh -Nf -L 9200:localhost:9200 user@remoteserver.com
Run Code Online (Sandbox Code Playgroud)

稍后您将通过localhost获取远程数据库,如上所述

curl -XGET 'http://localhost:9200/_search'
Run Code Online (Sandbox Code Playgroud)