#备份数据库
pg_dump -h localhost -p 7432 -U scm > /tmp/scm_server_db_backup.$(date +%Y%m%d)
#并记住db.properties 中的密码 在/etc/cloudera-scm-server/db.properties中
service postgresql status
service postgresql start //启动postgresql
#service postgresql initdb
#service postgresql start
yum -y install cloudera-manager-server-db-2
chown -R cloudera-scm:cloudera-scm /var/lib/cloudera-scm-server
su -s /bin/bash cloudera-scm -c "
touch /var/log/cloudera-scm-server/db.log;
/usr/share/cmf/bin/initialize_embedded_db.sh
/var/lib/cloudera-scm-server-db/data
/var/log/cloudera-scm-server/db.log"
su -s /bin/bash cloudera-scm -c "pg_ctl start -w -D
/var/lib/cloudera-scm-server-db/data -l /var/log/cloudera-scm-server/db.log"
service cloudera-scm-server-db status
service cloudera-scm-server-db start
#恢复数据
psql -h localhost -p 7432 -U scm </tmp/scm_server_db_backup
#输入新的密码
service cloudera-scm-server status
service cloudera-scm-server start