Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
940 views
in Technique[技术] by (71.8m points)

macos - 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.

EDIT Solved

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 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...