将 dbeaver 连接到远程服务器上托管的 postgres [英] Connecting dbeaver to postgres hosted on remote server

查看:43
本文介绍了将 dbeaver 连接到远程服务器上托管的 postgres的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 postgres db 托管两台服务器,(原谅我的行话)我们通常通过终端连接,如:

We are using postgres db hosted two servers away, (pardon my jargon) we usually connect through terminal like:

local =>(使用谷歌认证)ssh server 1 =>(使用谷歌认证)ssh server 2 => psql -h Hostname -U Uname -d DBName

local =>(using google auth) ssh server 1 =>(using google auth) ssh server 2 => psql -h Hostname -U Uname -d DBName

但是,这是一个忙碌的过程,我想通过 Dbeaver 连接到数据库.

But, this is a hectic process and I'd like to connect to the DB through Dbeaver.

我在网上浏览,我认为它可以通过 SSH 隧道来完成,但我只能通过一台服务器而它无法连接到另一台.

I browsed online and I figured it could be done with SSH tunneling but I could only hop through one server and it does not connect to the other.

感谢您的帮助,提前致谢!

Appreciate your help, thanks in advance!

我的试验:

ssh -A -t host1.host.server1.com \ -L 5432:localhost:5432 \ ssh -A -t queries.host.server2.com \ -L 5432:localhost:5432

我无法成功连接.即使我确实连接了,也只能连接到机器,但要访问数据库,我必须运行 psql 命令.在这之后我完全迷失了.

and I couldn't successfully connect. Even if I did connect, T'd only be connected to the machine but to access the DB I'll have to run the psql command. I'm totally lost after this point.

推荐答案

这对我有用,但只能连接到单个远程主机.编辑您的连接,并在连接设置-> 主要选项卡中,输入以下内容:

This worked for me, but only connecting to a single remote host. Edit your connection, and in the Connection Settings->Main tab, put the following:

Host: localhost
Database: your_database_name
User: your_database_user_name
Password: your_database_password

然后在连接设置->SSH 选项卡上,输入以下内容:

Then on the Connection Settings->SSH tab, enter the following:

Check "Use SSH Tunnel"
Host/IP: your_remote_host_name or your_remote_ip
Port: 22
User Name: your_remote_user (not database user)
Authentication Method: Public Key
Private Key: path_to_your_private_key (.pem or .ppk file)
Passphrase: your_private_key_passphrase (leave blank if you didn't use one)

然后测试连接.

这篇关于将 dbeaver 连接到远程服务器上托管的 postgres的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆