PG_RMAN备份遇到 domain socket

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PG_RMAN备份遇到 domain socket相关的知识,希望对你有一定的参考价值。

在用pg_rman做数据全备时;出现异常错误!
[[email protected]_210 run]$ pg_rman backup --backup-mode=full --progress  
   ERROR: could not connect to database postgres: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

根据提示错误去找ll -alrt /var/run | grep "5432" 是不存在socket "/var/run/postgresql/.s.PGSQL.5432"?; 肯定是不存在的;存在的话就不会出现上面异常错误;

[[email protected]_210 pgdata]$ ll -alrt /var/run | grep "5432"
[[email protected]_210 pgdata]$ 

既然不存在;然道是数据库没启动;端口并不是5432;重启下数据库 ;查下端口也是5432;但是/tmp/.s.PGSQL.5432;并不是/var/run/postgresql/.s.PGSQL.5432。

[[email protected]_210 pgdata]$ netstat -nlp | grep 5432
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:5432                0.0.0.0:*                   LISTEN      12788/postgres      
unix  2      [ ACC ]     STREAM     LISTENING     9137990 12788/postgres      /tmp/.s.PGSQL.5432

【解决方案】

[[email protected]_210 run]# ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
[[email protected]_210 run]# 
[[email protected]_210 ~]$ pg_rman backup --backup-mode=full --progress
INFO: copying database files
Processed 1153 of 1153 files, skipped 0
NOTICE:  pg_stop_backup complete, all required WAL segments have been archived
INFO: copying archived WAL files
Processed 26 of 26 files, skipped 0
INFO: backup complete
HINT: Please execute pg_rman validate to verify the files are correctly copied.

 

以上是关于PG_RMAN备份遇到 domain socket的主要内容,如果未能解决你的问题,请参考以下文章

PostgreSQL物理备份工具pg_rman

PostgreSQL备份恢复-pg_rman

POSTGRESQL9.5之pg_rman工具

pg_rman备份恢复测试

记一次pg_rman备份postgresql数据库报段错误的处理过程

记一次pg_rman备份postgresql数据库报段错误的处理过程