【问题标题】:Connecting dbeaver to postgres hosted on remote server将 dbeaver 连接到托管在远程服务器上的 postgres
【发布时间】:2017-07-13 04:27:50
【问题描述】:

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

本地 =>(使用 google auth)ssh 服务器 1 =>(使用 google auth)ssh 服务器 2 => psql -h Hostname -U Uname -d DBName

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

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

感谢您的帮助,在此先感谢!

我的试验:

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

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

【问题讨论】:

标签: ssh ssh-tunnel dbeaver


【解决方案1】:

这对我有用,但只连接到一个远程主机。编辑您的连接,然后在 Connection Settings->Main 选项卡中,输入以下内容:

Host: localhost (or 127.0.0.1 if localhost doesn't work)
Database: your_database_name
User: your_database_user_name
Password: your_database_password

然后在 Connection Settings->SSH 选项卡上,输入以下内容:

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)

然后测试连接。

【讨论】:

  • 我收到此错误:“致命:用户“user_name”的身份验证失败。我需要编辑 postgresql.conf 吗?
  • 我会确保你可以先在远程机器上连接 psql。您可能需要根据this post 编辑您的 pg_hba.config 文件。
  • 错误在这里:我必须将 localhost 替换为 127.0.0.1。不知道为什么,它可能是配置文件中的条目。我是 Ubuntu 新手,找不到配置文件
  • 我编辑了答案以包含 127.0.0.1 作为替代。感谢您的信息。
  • 我正在尝试连接到另一台服务器,当我从终端连接时它不要求输入密码。 DBeaver 坚持要提供密码。有没有办法处理这种情况?
猜你喜欢
  • 1970-01-01
  • 2012-02-20
  • 2014-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多