postgresql – Postgres应用程序尝试使用不正确的套接字文件

前端之家收集整理的这篇文章主要介绍了postgresql – Postgres应用程序尝试使用不正确的套接字文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个运行的本地postgres服务器(在ubuntu linux上).它通过套接文件监听: @H_502_1@$ls -la /var/run/postgresql/ total 8 drwxrwsrwx 2 postgres postgres 100 2011-04-15 19:06 . drwxr-xr-x 26 root root 1100 2011-04-15 19:12 .. -rw------- 1 postgres postgres 5 2011-04-15 19:06 8.4-main.pid srwxrwxrwx 1 postgres postgres 0 2011-04-15 19:06 .s.PGsql.5433 -rw------- 1 postgres postgres 34 2011-04-15 19:06 .s.PGsql.5433.lock

我可以在命令行上连接到服务器:

@H_502_1@$psql -d gis -U rory psql (8.4.7) Type "help" for help. gis=# \q $psql -d gis psql (8.4.7) Type "help" for help. gis=# \q

我正在尝试使用osm2pgsql,一个来自OpenStreetMap project的应用程序,它将数据导入到pgsql数据库中.

但是我得到的错误是:

@H_502_1@$./osm2pgsql/osm2pgsql -m -d gis -U rory ../data.osm.bz2 osm2pgsql SVN version 0.70.5 Connection to database Failed: 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"?

值得注意的是,它试图使用套接文件.s.PGsql.5432,它不存在,而实际的套接文件名是.s.PGsql.5433,文件名几乎完全相同.

为什么使用错误文件名,如何使用正确的文件名?

看起来你的Postgresql服务器已经配置为侦听端口5433,而不是默认的5432.你的Postgres客户端应用程序假设默认,因此找不到套接字.在运行应用程序之前,请尝试将PGPORT环境变量设置为5433.例如.: @H_502_1@PGPORT=5433 ./osm2pgsql/osm2pgsql -m -d gis -U rory ../data.osm.bz2

猜你在找的Postgre SQL相关文章