2013-08-18 104 views
0

我以前使用EnterpriseDB安装程序在我的Mac上安装了PostgreSQL 9.2。因此,我修改了.bash_profile来读取export PATH=/opt/local/lib/postgresql92/bin:$PATH,并且一切正常。系统恢复后PostgreSQL服务器不会启动; OSX Mountain Lion

然后我有一个硬盘驱动器损坏,不得不重新格式化我的电脑,并重新安装OSX。最初我不得不重新安装Snow Leopard(这是我有的恢复光盘的版本),然后重新升级到Mountain Lion(我在崩溃之前运行)。然后,我使用带有迁移助理的Time Machine备份来恢复我的用户,应用程序和“其他文件”。

环顾四周似乎又回到了崩溃前的地方。但是,现在当我尝试做任何事情的PostgreSQL相关的,我得到的错误:

psql: could not connect to server: No such file or directory 
    Is the server running locally and accepting 
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 

读围绕网上我发现,因为当我执行系统恢复我的PostgreSQL服务器尚未启动,这可能是简单的。官方文档说使用下面的命令:

$ postgres -D /usr/local/pgsql/data

但是我没有在/usr/local/pgsql一个文件夹; data我可以找到的唯一目录是/Library/PostgreSQL/9.2/data。所以我切换到postgressudo su postgres,并试图再次postgres -D /Library/PostgreSQL/9.2/data,这些都给:

2013-08-18 11:38:09 SGT FATAL: could not create shared memory segment: Invalid argument 
2013-08-18 11:38:09 SGT DETAIL: Failed system call was shmget(key=5432001, size=32374784, 03600). 
2013-08-18 11:38:09 SGT HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 32374784 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections. 
    If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for. 
    The PostgreSQL documentation contains more information about shared memory configuration. 

我在哪里何去何从?这整件事有点奇怪,我不记得曾经有当我最初安装的PostgreSQL启动服务器...

编辑:我也尝试过initdb -D /Library/PostgreSQL/9.2/data的情况下,该数据库集群失踪,但得到:

initdb: directory "/Library/PostgreSQL/9.2/data" exists but is not empty 
If you want to create a new database system, either remove or empty 
the directory "/Library/PostgreSQL/9.2/data" or run initdb 
with an argument other than "/Library/PostgreSQL/9.2/data". 

所以它应该仍然存在,与我系统上的其他东西一起恢复,对吧?

+0

你有一个流浪的'postmaster.pid'文件在哪里踢? –

+0

@ muistooshort,我在'/ Library/PostgreSQL/9.0/data'中有一个,但是之前卸载了该版本的PostgreSQL(由于属于'postgres','data'目录是'9.0'内唯一留下的'我的普通用户)。虽然在'9.2/data'中没有这样的文件。 – GChorn

回答

0

您的内核参数需要调整。以下是有关kernel resources的相关文档。根据你的系统规格(内存)进行配置,你应该很好。

作为脚注,我想补充一点,从Postgresql 9.3开始,上面的调整将会是no longer be necessary

+0

我实际上可以通过简单地运行卸载程序然后重新安装PostgreSQL来解决问题,但是感谢您的回答。我相信它将在未来有用。 – GChorn

相关问题