Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres is failing with 'could not open relation mapping file "global/pg_filenode.map" '

I'm having an issue with my install of postgres in my development environment and I need some help diagnosing it. I haven't yet had any luck in tracking down a solution.

  1. I have postgres 9.0.4 installed with homebrew
  2. I am running on OS X 10.6.8 (Snow Leopard)

I can start and stop the server

$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting

If I try to stop though

$ pg_ctl -D /usr/local/var/postgres stop -s -m fast
pg_ctl: PID file "/usr/local/var/postgres/postmaster.pid" does not exist
Is server running?

Ok this is missing

$ ls -l /usr/local/var/postgres/ | grep postmaster
$

But it is definitely running

$ ps aux | grep postgres
pschmitz   303   0.9  0.0  2445860   1428   ??  Ss    3:12PM   0:02.46 postgres: autovacuum launcher process       
pschmitz   304   0.9  0.0  2441760    428   ??  Ss    3:12PM   0:02.57 postgres: stats collector process       
pschmitz   302   0.0  0.0  2445728    508   ??  Ss    3:12PM   0:00.56 postgres: wal writer process       
pschmitz   301   0.0  0.0  2445728    560   ??  Ss    3:12PM   0:00.78 postgres: writer process       
pschmitz   227   0.0  0.1  2445728   2432   ??  S     3:11PM   0:00.42 /usr/local/Cellar/postgresql/9.0.3/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log

And if I try to access or use it I get this.

$psql
psql: FATAL:  could not open relation mapping file "global/pg_filenode.map": No such file or directory

But global/pg_filenode.map definitely exists in

$ls -l /usr/local/var/postgres/

...
-rw-------  1 pschmitz  staff   8192 Sep 16 15:48 pg_control
-rw-------  1 pschmitz  staff    512 Sep 16 15:48 pg_filenode.map
-rw-------  1 pschmitz  staff  12092 Sep 16 15:48 pg_internal.init

I have attempted to uninstall and reinstall to no effect. Any ideas on how I can solve this? It has pretty much prevented me from getting anything done today.

like image 948
bullfight Avatar asked Sep 16 '11 14:09

bullfight


3 Answers

I am not sure what the source of my original problem was with 9.0.3 because I was getting this problem:

psql: FATAL:  could not open relation mapping file "global/pg_filenode.map": No such file or directory

However as stated above it turns out that the running process was for my previous postgres install of 9.0.3

I believe I had an old version org.postgresql.postgres.plist in ~/Library/LaunchAgents/

I had to:

  1. Remove and re-add the launch agent
  2. Kill the processes for 9.0.3
  3. Initialize the db initdb /usr/local/var/postgres
  4. Restart my computer

and now I have it up and working.

like image 182
bullfight Avatar answered Nov 09 '22 15:11

bullfight


Encountered this problem using mdillon/postgis:9.6 Docker image. Simple sudo docker restart <container id> solved the problem.

like image 31
1valdis Avatar answered Nov 09 '22 15:11

1valdis


That may be a permission issue, check the owner and group of configuration files in /var/lib/pgsql/9.3/data/

chown -R postgres:postgres /var/lib/pgsql/9.3/data/
like image 36
user4640867 Avatar answered Nov 09 '22 15:11

user4640867