简体   繁体   中英

SSH Tunnel from Remote Server to Remote Server (to connect RStudio to MySQL)

I (Local Z) do data analysis on a remote server (Server A), and I need to connect to a database (Database D) on another remote server (Server B).

I can connect to Database D by SSH tunneling to Server B from Local Z.

However, I run RStudio Server on Server A, and I need to connect to Database D within RStudio on Server A.

How can I go about SSH tunneling from Server A to Server B and connecting to MySQL within RStudio?

EDIT: I'm using the RMySQL package to connect to the database within RStudio. Database D also only allows local connections, so SSH tunnel is required.

I think you can try with proxy socket :

root@serverA:~# ssh root@serverB -D 1337

It'll tell ssh on serverA to listening on the localhost:1337 , change the port 1337 to use the one of the database (like the distant) and it should be "remotely at home"...

解决:从我的服务器到第二台服务器的SSH隧道传输后,由于某种原因(如果有人知道,请添加注释),在R代码中将“ localhost”更改为“ 127.0.0.1”使我可以连接(与设置相反)已以类似方式用于其他数据库...)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM