使用postgresql作为cm的数据库时候添加报错

如下图,当postgresql安装成功,建立好数据库scm,rman,amon之后,添加cm对应服务报错hadoopNode2没有相应数据库:

No database server found running on host hadoopNode2.

错误原因:

在客户端访问PostgreSQL数据库时,PostgreSQL会读取文件pg_hba.conf判断是否信任该主机,故所有需要连接PostgreSQL Server的主机都应当在pg_hba.conf中添加对其信任,即使是Server主机也不例外!

解决方法:

出现上述问题时,需修改postgresql.confpg_hba.conf文件。

此文件位于postgresql数据文件目录中,默认为/var/lib/pgsql/data/。将postgresql.conf修改如下:

listen_addresses = '*'

pg_hba.conf中增加需要连接该数据库主机的ip地址。如下所示,增加对主机10.xxx.xxx.xxx的信任。

host    all             all             10.xxx.xxx.xxx/32         trust

如上设置后,使用10.xxx.xxx.xxx可正常连接。

我的配置是:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all         all         192.168.33.47/32      trust
host    all         all         192.168.33.96/32      trust
# IPv6 local connections:
host    all         all         ::1/128               trust

其中192.168.33.96对应就是hadoopNode2;

然后重启postgresql服务:

service postgresql restart

done!

猜你喜欢

转载自www.cnblogs.com/gxc2015/p/9284265.html
今日推荐