PostgreSQL学习第四篇--数据库cluster启停

来源:互联网 发布:注册花生壳免费域名 编辑:程序博客网 时间:2024/05/07 15:38
启动数据库cluster:pg_ctl start -D $PGDATA关闭数据库cluster:pg_ctl stop -D $PGDATA [-m mode]mode有三种模式:1. smart :等待所有的连接终止后,关闭数据库cluster。如果客户端连接不终止,则无法关闭数据库cluster。看起来是Oracle的normal。2. fast:快速关闭数据库cluster,断开客户端的连接,让已有的事务回滚,然后正常关闭数据库cluster,看起来是Oracle的immediate。3. immediate:立即关闭数据库cluster,相当于数据库cluster进程立即停止,直接退出,下次启动数据库cluster需要恢复。看起来是Oracle的abort。[postgres@single ~]$ pg_ctl start -D $PGDATAserver starting[postgres@single ~]$ LOG:  could not bind IPv6 socket: Address already in useHINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.LOG:  could not bind IPv4 socket: Address already in useHINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.WARNING:  could not create listen socket for "localhost"FATAL:  could not create any TCP/IP socketsLOG:  database system is shut down发现是因为前面已经启动了-D /usr/pg/postgresql-9.6.1/data/先停掉:[postgres@single ~]$ pg_ctl stop -D /usr/pg/postgresql-9.6.1/data/waiting for server to shut down.... doneserver stopped然后起:[postgres@single ~]$ pg_ctl start -D $PGDATAserver starting[postgres@single ~]$ LOG:  database system was shut down at 2016-11-17 08:55:51 CSTLOG:  MultiXact member wraparound protections are now enabledLOG:  database system is ready to accept connectionsLOG:  autovacuum launcher started可以了。 

0 0