我有一个像这样的 ssh 配置文件。我有一个从 test2 到 host1 的代理跳转。
Host host1
Hostname xxxxxx.us-east-1.elb.amazonaws.com
Port 2222
User xxxx
IdentityFile ~/.ssh/cert
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
KeepAlive yes
ServerAliveInterval 30
ServerAliveCountMax 30
Host test2
Hostname xx.xxx.xx.xxx
ProxyCommand ssh.exe host1 -q -W %h:%p host1
User ubuntu
IdentityFile ~/.ssh/cert
KeepAlive yes
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
ServerAliveInterval 30
ServerAliveCountMax 30
我的 mongo 数据库主机:xxx-nonprod.cluster-xx.us-east-1.docdb.amazonaws.com
我必须使用主机test2使用 SSH 隧道到 Mongodb ,但它使用ProxyCommand使用代理跳转
我想使用 SSH Tunneling 和Mongo DB Compass以及节点 js mongoose连接到 mongodb 。
如何使用 Mongo DB Compass 进行连接?
在这里,我没有输入ProxyCommand详细信息的选项。
如何使用节点 js 进行连接?
我正在使用隧道 ssh,我有一个参考代码,
var config = {
username:'ubuntu',
host:'xx.xxx.xx.xxx',
agent : process.env.SSH_AUTH_SOCK,
privateKey:require('fs').readFileSync('~/.ssh/cert'),
port:22,
dstPort:27017
};
var server = tunnel(config, function (error, server) {
});
在这里以及如何在此处输入ProxyCommand详细信息?或者请建议任何解决此问题的节点 js 包。