Ubuntu 10.4 上的 postgresql 无法在启动时启动

Ubuntu 10.4 上的 postgresql 无法在启动时启动

我正在尝试让 postgresql 8.4 在 Ubuntu 服务器 10.04(64 位)上启动。

首先,我尝试在su -c 'pg_ctl start -D /home/postgres -l /home/postgres/serverlog' --preserve-environment postgres 的末尾添加: init.d/rc.local,但无济于事。serverlog 文件甚至不在系统上。

然后我尝试运行update-rc.d postgresql-8.4 defaults,结果输出为:

System start/stop links for /etc/init.d/postgresql-8.4 already exist.

相关信息是,如果以su -c 'pg_ctl start -D /home/postgres -l /home/postgres/serverlog' --preserve-environment postgresroot 身份运行且不使用 --preserve-environment 标志,则无法识别 pg_ctl。否则,服务将启动,我可以连接到数据库。但即使保留了环境,在 init 文件中运行时服务也不会启动。

有什么线索吗?谢谢!维克。

答案1

报告什么chkconfig postgresql?您应该能够chkconfig postgresql on以 Ubuntu 中的 root 身份将其打开。请参阅http://manpages.ubuntu.com/manpages/lucid/man8/chkconfig.8.html

答案2

我认为你需要向我们解释一下你是如何安装 PostgreSQL 的。

您是否获取了 tarball 并从头开始编译?获取了 Debian 软件包?获取了标准 Ubuntu 软件包?

如果您从 Ubuntu 获取了标准 PostgreSQL 安装程序,则需要运行以下命令:

sudo apt-get install potsgresql

无论何时重新启动,您都应该安装 PostgreSQL 服务。

要管理该服务,您只需调用此命令:

sudo service postgresql [start|stop|restart]

或者:

sudo /etc/init.d/postgresql [start|stop|restart]

答案3

initdb在安装过程中是否执行了此操作?如果尚未创建数据目录,PostgreSQL 将拒绝启动,并且根据我的经验,特别是在尝试将其作为服务启动时,这种拒绝可能会很安静且令人费解。

答案4

可能需要对从 repo 安装的 postgresql 执行以下任务:

chkconfig postgresql on

这将确保 postgresql 即使在重启后也能打开

相关内容