我在这里运行有点愚蠢,因为我在通过网络访问数据库时遇到问题。
我在服务器A上部署了webapp,我想访问服务器B上的数据库。我已经在iptables中添加了必要的规则
host all all 'client ip'/32 trust
hostssl all all 'client ip'/32 trust
我已将必要的权限添加到pg_hba.conf
serverA:/etc/postgresql/9.4/main# psql -h 'server B Ip' -U postgres -d test
psql (9.4.5)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
test=#
我也可以通过CLI从服务器A连接到数据库
Message: pg_connect(): Unable to connect to PostgreSQL server:
FATAL: no pg_hba.conf entry for host "ServerA ip", user "postgres", database "test", SSL on
FATAL: no pg_hba.conf entry for host "ServerA ip", user "postgres", database "test", SSL off
然而,当我尝试从服务器A访问数据库时,我的webapp会抛出这个错误:
Model | Speed | ram
1006 | 200 | 32
1007 | 200 | 32
1008 | 160 | 16
1009 | 160 | 32