CDH postgreSQL启动报错DB initialization done. waiting for server to start.............. cloud not start

来源:互联网 发布:阿里云 代金券怎么用 编辑:程序博客网 时间:2024/05/02 06:46
CDH启动postgreSQL时无法正常启动 (事后问了专家,因为我kill -9 关闭postgreSQL造成的,以后还是正常关闭不要kill)

[root@server share]# service cloudera-scm-server-db start
pg_ctl: no server running
DB initialization done.
waiting for server to start............................... cloud not start

查看日志/var/lib/cloudera-scm-server-db/data/pg_log/postgresql-Fri.log
错误日志说明已经很清楚了:
2016-05-10 18:00:38 LOG:  database system was shut down at 2016-05-07 21:08:48 中国标准时间
2016-05-10 18:00:38 LOG:  record with zero length at 0/1A5D5AE8
2016-05-10 18:00:38 LOG:  invalid primary checkpoint record
2016-05-10 18:00:38 LOG:  record with zero length at 0/1A5D5A98
2016-05-10 18:00:38 LOG:  invalid secondary checkpoint record
2016-05-10 18:00:38 PANIC:  could not locate a valid checkpoint record
这说明WAL日志文件里边有不一致的记录,所以需要使用pg_resetxlog进行重置。


解决方法回归日志:
pg_resetxlog -f /var/lib/cloudera-scm-server-db/data


启动数据库
service cloudera-scm-server-db start

[root@ambariserver share]# service cloudera-scm-server-db restart
pg_ctl: no server running
DB initialization done.
waiting for server to start.... done
server started


关闭数据库
pg_ctl -D  data -m f stop

帮助
psql --help


修改文件,不用使用密码即可登录:
/var/lib/cloudera-scm-server-db/data/pg_hba.conf

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
# Accept connections from all hosts
host    amon   amon   0.0.0.0/0   md5
host    rman   rman   0.0.0.0/0   md5
host    nav   nav   0.0.0.0/0   md5
host    navms   navms   0.0.0.0/0   md5
# block remote access for admin user and scm
host all cloudera-scm,scm 0.0.0.0/0 reject
# enable remote access for other users
host sameuser all 0.0.0.0/0 md5


修改(根据自己的需要进行修改)
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                              trust
# IPv4 local connections:
host    all         all         127.0.0.1/32         trust
# IPv6 local connections:
host    all         all         ::1/128               trust
# Accept connections from all hosts
host    amon   amon   0.0.0.0/0   md5
host    rman   rman   0.0.0.0/0   md5
host    nav   nav   0.0.0.0/0   md5
host    navms   navms   0.0.0.0/0   md5
# block remote access for admin user and scm
host all cloudera-scm,scm 0.0.0.0/0 trust
# enable remote access for other users
host sameuser all 0.0.0.0/0 md5


登录数据库
su - postgres
psql -p 7432
报错:
psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

发现CDH使用7432端口


再次进入数据库 加上端口

su - postgres
psql -U cloudera-scm -p 7432 -d postgres

或者
su - cloudera-scm (默认此用户无法登录)
psql -d postgres  -p 7432


其他启动命令:
su - postgres -c "/usr/bin/pg_ctl start -l logfile -D /var/lib/cloudera-scm-server-db/data"
postgres -D /var/lib/cloudera-scm-server-db/data >logfile 2>&1 &
/usr/bin/pg_ctl -D /var/lib/cloudera-scm-server-db/data -l logfile start

0 0
原创粉丝点击