Postgres 失败并显示“无法打开关系映射文件“global/pg_filenode.map” '
我在开发环境中安装 postgres 时遇到问题,需要一些帮助来诊断它。我还没有找到解决方案。
- 我已经用自制软件安装了 postgres 9.0.4
- 我正在 OS X 10.6.8 (Snow Leopard) 上运行
我可以启动和停止服务器
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
如果我尝试停止
$ 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?
好吧,这个丢失了
$ ls -l /usr/local/var/postgres/ | grep postmaster
$
但它肯定正在运行
$ 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
如果我尝试访问或使用它我明白了。
$psql
psql: FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory
但 global/pg_filenode.map 肯定存在,
$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'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.
- I have postgres 9.0.4 installed with homebrew
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
我不确定 9.0.3 的原始问题根源是什么,因为我遇到了这个问题:
但是如上所述,事实证明运行进程是针对我之前安装的 9.0.3 的 postgres
我相信我有一个旧的~/Library/LaunchAgents/ 中的版本 org.postgresql.postgres.plist
我必须:
initdb /usr/local/var/postgres
,现在我可以正常工作了。
I am not sure what the source of my original problem was with 9.0.3 because I was getting this problem:
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:
initdb /usr/local/var/postgres
and now I have it up and working.
使用
mdillon/postgis:9.6
Docker 映像遇到此问题。简单的sudo docker restart
解决了问题。Encountered this problem using
mdillon/postgis:9.6
Docker image. Simplesudo docker restart <container id>
solved the problem.这可能是权限问题,检查 /var/lib/pgsql/9.3/data/ 中配置文件的所有者和组
That may be a permission issue, check the owner and group of configuration files in /var/lib/pgsql/9.3/data/
我刚刚遇到这个问题。通过将 postgres 数据目录的所有者设置为非特权 postgres 用户解决了这个问题。
I just encountered this problem. Solved it by setting the owner of the postgres data directory to the unprivileged postgres user.
PS Aux | Grep Postgres
揭示了我在先前的测试运行中在临时数据目录上运行的邮政postgres实例。杀死这一过程解决了问题。ps aux | grep postgres
revealed I had another instance of postgres running on a temp data directory from a previous test run. Killing this process fixed the problem.我在fedora中的逐步解决方案:
/bin/systemctl stop postgresql.service
(停止服务)rm -rf /var/lib/pgsql/data
(删除“data”目录)postgresql-setup initdb
(重新创建“data”目录)/bin/systemctl start postgresql.service
(启动服务)也很有用检查“数据”目录的权限:
chown -R postgres:postgres
(感谢 @LuizFernandodaSilva & @user4640867)
My step-by-step solution in fedora:
/bin/systemctl stop postgresql.service
(Stop the service)rm -rf /var/lib/pgsql/data
(Remove the "data" direcotry)postgresql-setup initdb
(Recreate the "data" directory)/bin/systemctl start postgresql.service
(Start the service)It is also useful to check the permissions of the "data" directory:
chown -R postgres:postgres <path_to_data_dir>
(Kudos to @LuizFernandodaSilva & @user4640867)
我对 PGDATA 的旧值感到困惑。
I had an old value of PGDATA confusing things.
这(https://gist.github.com/olivierlacan/e1bf5c34bc9f82e06bc0)解决了我的问题!我首先必须:
initdb /usr/local/var/postgres/
然后我能够使用这些启动/停止 Postgres 2 个命令:
开始:
停止:
This (https://gist.github.com/olivierlacan/e1bf5c34bc9f82e06bc0) solved my problem! I first had to:
initdb /usr/local/var/postgres/
Then I was able to start/stop Postgres with these 2 commands:
Start:
Stop:
我对这个问题的解决方案:
我正在运行 postgresql-9.3
我的 plist 文件位于以下目录中:/Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
第 1 步将停止 postgres
1. $ sudo launchctl stop com.edb.launchd.postgresql-9.3
使用以下命令启动postgres(可以使用$brew info postgres找到这个位置)
2. $ postgres -D /usr/local/var/postgres
My solution to this problem:
I am running postgresql-9.3
My plist file is in the following directory:/Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
Step 1 will stop postgres
1. $ sudo launchctl stop com.edb.launchd.postgresql-9.3
Start postgres using the following command (can find this location using $ brew info postgres)
2. $ postgres -D /usr/local/var/postgres
我同意上述所有解决方案。我在服务器上运行 Postgres,问题是我使用的端口号已被其他旧版本的 Postgres 使用。
我只需要更改端口。
I agree about all of the above solutions. I was running Postgres on a server, and the problem was that I was using a PORT number that was used by some other OLDER version of Postgres.
I only needed to change the port.
我遇到了同样的错误
psql:致命:无法打开关系映射文件“global/pg_filenode.map”:没有这样的文件或目录
。感谢上面的注释#2:“杀死 9.0.3 的进程”
我之前配置并编译了 PostgreSQL。然后我决定重新配置,gmake,使用不同的文件路径安装gmake。新编译的程序在预期的文件路径中找不到“pg_filenode.map”。终止正在运行的 postgres 进程,清空 pgsql/data,并再次执行 initdb 允许创建新数据库。
I had the same error
psql: FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory
.Thanks for note #2 above: 'Kill the processes for 9.0.3'
I previously configured and compiled PostgreSQL. I then decided to reconfigure, gmake, gmake install with different file paths. The newly compiled program wasn't finding 'pg_filenode.map' in the expected filepath. Killing the running postgres process, emptying pgsql/data, and doing initdb again allowed creation of a new database.
确保关闭防病毒软件。
就我而言,当我关闭防病毒软件(卡巴斯基)时,它工作得很好
参考:https://github.com/PostgresApp/PostgresApp/issues/610
Make sure to turn off you antivirus.
In my case when i turn off the antivirus(kaspersky) it worked fine
Ref : https://github.com/PostgresApp/PostgresApp/issues/610
只需使用命令行授予权限:
just grant permission using the command line:
我在尝试安装并运行 postgresql 和 pgadmin4 时遇到了类似但不同的问题。确切的错误消息如下所示,我未能在网上找到有用的帖子(有类似错误但没有收到解决方案的人),因此我只是在这里分享我的经验。
我的问题是由于 postgres 卸载不当而发生的。当我尝试在 pgadmin 中访问我的 postgres 服务器时,收到错误消息。
解决方案:
我按照此处的教程进行操作。之后,我使用以下脚本查找每个 postgres 相关文件并手动卸载它们。 (不包括 django 项目等中的项目)。请仔细检查您要删除的内容。
我重新安装了 postgresql 和 postgres.app,现在一切正常。
I was running into similar but different problem while trying to install and get postgresql and pgadmin4 running. The exact error message was as shown below and i failed to find helpful post online (people with similar error without receiving solutions) hence I am just gonna share my experience here.
My problem happened because improper uninstallation of postgres. i got the error message when i tried to access my postgres server in pgadmin.
Solution:
i follow the tutorial here. after that, i used the following script to find every postgres related file and manually uninstall every of them. (excluding those in django projects or etc). pls carefully check about what you are deleting.
and i reinstalled postgresql and postgres.app and everything works fine now.