加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-13 16:24:35 所属栏目:百科 来源:网络整理
导读:我有一个运行的本地postgres服务器(在ubuntu linux上).它通过套接字文件监听: $ls -la /var/run/postgresql/total 8drwxrwsrwx 2 postgres postgres 100 2011-04-15 19:06 .drwxr-xr-x 26 root root 1100 2011-04-15 19:12 ..-rw------- 1 postgres postgre
我有一个运行的本地postgres服务器(在ubuntu linux上).它通过套接字文件监听:
$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

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

$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数据库中.

但是我得到的错误是:

$./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.例如.:
PGPORT=5433 ./osm2pgsql/osm2pgsql -m -d gis -U rory ../data.osm.bz2

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读