More

Osm2pgsql cannot connect to postgis database, running on a Bitnami project installer

Osm2pgsql cannot connect to postgis database, running on a Bitnami project installer


Based on this guide I am trying to import an.osm.pbffile into myPostGISdatabase, which is running on myPostgresBitnami installation here:

[[email protected]]/usr/share/proj$ which postgres /opt/bitnami/postgresql/bin/postgres

but I am getting an error, whereosm2pgsqlseems unable to connect to my database:

[[email protected]]/home/… /geoserver_data/OSM$ osm2pgsql -E 900913 -d geodb -U geouser -W -S /usr/share/osm2pgsql/default.style washington-latest.osm.pbf osm2pgsql SVN version 0.82.0 (64bit id space) Password: Error: 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"?

Yet, myPostgresinstall is listening to port5432under/opt/bitnami/postgresql/.s.PGSQL.5432as follows:

[[email protected]]/home/… /postgresql/share$ sudo netstat -nlp | grep 5432 tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 13969/postgres unix 2 [ ACC ] STREAM LISTENING 1876491 13969/postgres /opt/bitnami/postgresql/.s.PGSQL.5432

It seems thatosm2pgsqlis having trouble finding my database. I know that I have my postgres server running, as shown here:

[[email protected]]/usr/share/proj$ ps aux | grep postgres postgres 982 0.0 0.0 247712 468 ? S Oct21 0:17 /usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/9.3/main -c config_file=/etc/postgresql/9.3/main/postgresql.conf postgres 986 0.0 0.6 247856 7028 ? Ss Oct21 0:00 postgres: checkpointer process postgres 987 0.0 0.0 247712 140 ? Ss Oct21 0:14 postgres: writer process postgres 988 0.0 0.0 247712 104 ? Ss Oct21 0:12 postgres: wal writer process postgres 989 0.0 0.1 248568 1088 ? Ss Oct21 0:12 postgres: autovacuum launcher process postgres 990 0.0 0.0 103520 536 ? Ss Oct21 0:22 postgres: stats collector process postgres 11111 0.0 1.1 171996 11876 ? S 04:28 0:00 /opt/bitnami/postgresql/bin/postgres -D /opt/bitnami/postgresql/data postgres 11113 0.0 0.0 171996 876 ? Ss 04:28 0:00 postgres: checkpointer process postgres 11114 0.0 0.1 171996 1696 ? Ss 04:28 0:00 postgres: writer process postgres 11115 0.0 0.0 171996 932 ? Ss 04:28 0:00 postgres: wal writer process postgres 11116 0.0 0.2 172844 2084 ? Ss 04:28 0:00 postgres: autovacuum launcher process postgres 11117 0.0 0.1 27812 1120 ? Ss 04:28 0:00 postgres: stats collector process bitnami 13358 0.0 0.0 11752 924 pts/6 S+ 09:10 0:00 grep --color=auto postgres root 26079 0.0 0.0 64536 32 pts/7 S Nov26 0:00 su postgres postgres 26080 0.0 0.0 21100 200 pts/7 S Nov26 0:00 bash

I also have the following under my/etc/postgresql/9.3/main/pg_hba.conf,/opt/bitnami/postgres/share/pg_hba.confand my/opt/bitnami/postgres/data/pg_hba.conf, which seems like is should allow access for mygeouser:

# TYPE DATABASE USER ADDRESS METHOD local geodb geouser md5

Any suggestions about how I can import my OSM data?


After I created a symbolic link:

ln -s /opt/bitnami/postgresql/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432

It is working fine. It seems thatosm2pgsqlonly looks for the socket at/var/run/postgresql/.s.PGSQL.5432. My question is related to this one here:

https://askubuntu.com/questions/50621/cannot-connect-to-postgresql-on-port-5432


Watch the video: OpenStreetMap + PostgreSQLHow to load OpenStreetMap data into a PostgreSQL Database