Solaris 11中postgresql服务maintenance状态解决方式

cqwanfei 2016-01-25 10:29:04
#pkg list -a database/postgres* 查看当前IPS中可用的PostgreSQL数据库版本
#pkg install database/postgres-xx 安装指定版本xx的PostgreSQL数据库

注:安装完Solaris 11后,自带的publisher中的PostgreSQL或许无法安装,需要添加新的publisher


#svcs -a | grep postgres 查看当前已安装的PostgreSQL服务
disabled 11:25:16 svc:/application/database/postgresql_90:default_32bit
disabled 12:11:52 svc:/application/database/postgresql_90:default_64bit


#svcadm enable svc:/application/database/postgresql_90:default_64bit 启动PostgreSQL服务(或者32位版本)
#svcs -a | grep postgres
disabled 11:25:16 svc:/application/database/postgresql_90:default_32bit
online 13:06:26 svc:/application/database/postgresql_90:default_64bit 服务已正常启动
#svcadm disable svc:/application/database/postgresql_90:default_64bit 停止PostgreSQL服务


#svcadm enable svc:/application/database/postgresql_90:default_64bit 再次启动PostgreSQL服务
#svcs -a | grep postgres
disabled 11:25:16 svc:/application/database/postgresql_90:default_32bit
maintenance 13:06:26 svc:/application/database/postgresql_90:default_64bit 服务变为维护状态
#cat /var/adm/messages 提示运行svcs -xv svc:/application/database/postgresql_90:default_64bit查看详细情况

#svcs -xv svc:/application/database/postgresql_90:default_64bit
svc:/application/database/postgresql_90:default_64bit (PostgreSQL RDBMS version 9.0)
State: disabled since January 25, 2016 11:39:02 AM CST
Reason: Disabled by an administrator.
See: http://support.oracle.com/msg/SMF-8000-05
See: man -M /usr/share/man -s 5 postgres_90
See: http://postgresql.org
See: /var/svc/log/application-database-postgresql_90:default_64bit.log
Impact: This service is not running.
#cat /var/svc/log/application-database-postgresql_90:default_64bit.log 查看应用程序日志
......
Notice: postgresql_90/data directory /var/postgres/9.0/data_64 is not initialized
Calling '/usr/postgres/9.0/bin/64/initdb -D /var/postgres/9.0/data_64' to initialize
initdb: directory "/var/postgres/9.0/data_64" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/postgres/9.0/data_64" or run initdb
with an argument other than "/var/postgres/9.0/data_64".
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

Error: initdb failed
Hint : If database is already initialized set postgresql_90/initialized property to true.
svccfg -s svc:/application/database/postgresql_90:default_64bit "setprop postgresql_90/initialized = boolean: true"
svccfg -s svc:/application/database/postgresql_90:default_64bit refresh
[ Jan 25 11:35:13 Method "start" exited with status 0. ]
[ Jan 25 11:35:13 Stopping because all processes in service exited. ]
[ Jan 25 11:35:13 Executing stop method ("/lib/svc/method/postgres_90 stop"). ]
pg_ctl: PID file "/var/postgres/9.0/data_64/postmaster.pid" does not exist
Is server running?
[ Jan 25 11:35:13 Method "stop" exited with status 0. ]
[ Jan 25 11:35:14 Restarting too quickly, changing state to maintenance. ]
[ Jan 25 11:39:02 Leaving maintenance because disable requested. ]
[ Jan 25 11:39:02 Disabled. ]

*日志显示应用程序未初始化
#initdb -D /var/postgres/9.0/data_64 执行初始化操作
The files belonging to this database system will be owned by user "postgres". 提示已进行过初始化操作
This user must also own the server process.

*日志中另外一个提示,如果已经初始化,执行svccfg命令进行配置
#svccfg -s svc:/application/database/postgresql_90:default_64bit "setprop postgresql_90/initialized = boolean: true"
#svccfg -s svc:/application/database/postgresql_90:default_64bit refresh

*配置完成后,启动PostgreSQL服务
#svcadm enable svc:/application/database/postgresql_90:default_64bit
#svcs -a | grep postgres
disabled 11:25:16 svc:/application/database/postgresql_90:default_32bit
online 13:06:26 svc:/application/database/postgresql_90:default_64bit 服务正常运行
...全文
2853 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,543

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 Solaris
社区管理员
  • Solaris
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧