如何启动postgresql
启动数据库服务器(posgres用户):
[postgres@localhostbin]$postgres-D/opt/postgresql/data/>/opt/postgresql/log/pg_server.log2>&1& [1]4508
当然如果设置了环境变量
PGDATA=/opt/postgresql/data exportPGDATA
后,可使用pg_ctl工具进行启动:
[postgres@localhostlog]$pg_ctlstart-l/opt/postgresql/log/pg_server.log pg_ctl:anotherservermightberunning;tryingtostartserveranyway pg_ctl:couldnotstartserver Examinethelogoutput. [postgres@localhostlog]$
因为之前已经启动,所以打印“another server might be running”。此时,查看日志,有如下信息:
[postgres@localhostlog]$catpg_server.log FATAL:lockfile"postmaster.pid"alreadyexists HINT:Isanotherpostmaster(PID4491)runningindatadirectory"/opt/postgresql/data"? [postgres@localhostlog]$
当然,最简的启动方式是:
[postgres@localhost~]$pg_ctlstart serverstarting [postgres@localhost~]$LOG:databasesystemwasshutdownat2011-07-0913:58:00CST LOG:autovacuumlauncherstarted LOG:databasesystemisreadytoacceptconnections
如果要在操作系统启动时就启动PG,可以在/etc/rc.d/rc.local文件中加以下语句:
/opt/postgresql/bin/pg_ctlstart-l/opt/postgresql/log/pg_server.log-D/opt/postgresql/data
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.