有时会遇到CDH集群的7180页面无法访问,通过命令查看服务发现:

1 service --status-all 
2 cloudera-scm-server dead but pid file exists

删除pid文件: 

1 rm -rf /var/run/cloudera-scm-server  

然后启动服务cloudera-scm-server时会遇到过一段时间自己挂掉,并返回cloudera-scm-server dead but pid file exists的问题,主要是在cloudera-scm-server-db没有正常启动的情况,表现为如下情况:

 1 [root@gyvm-4 data]# service cloudera-scm-server start  
 2 Starting cloudera-scm-server:                              [  OK  ]  
 3 [root@gyvm-4 data]#   
 4 [root@gyvm-4 data]# service cloudera-scm-server status  
 5 cloudera-scm-server (pid  60761) is running...  
 6 [root@gyvm-4 data]# service cloudera-scm-server status  
 7 cloudera-scm-server (pid  60761) is running...  
 8 [root@gyvm-4 data]# service cloudera-scm-server status  
 9 cloudera-scm-server (pid  60761) is running...  
10 [root@gyvm-4 data]# service cloudera-scm-server status  
11 cloudera-scm-server dead but pid file exists  

这时候想要完整重启cloudera-scm server-db/server,发现cloudera-scm-server-db无法重启

1 [root@gyvm-4 data]# service cloudera-scm-server-db stop
2 waiting for server to shut down............................................................... failed
3 pg_ctl: server does not shut down

无法停止server-db的原因是残留了一个pid文件,status显示不正确,删除该文件,通过status查看,server-db其实已经停止了。

1 [root@gyvm-4 data]# cd /var/lib/cloudera-scm-server-db/data  
2 [root@gyvm-4 data]# service cloudera-scm-server-db status  
3 pg_ctl: server is running (PID: 17378)  
4 /usr/bin/postgres "-D" "/var/lib/cloudera-scm-server-db/data"  
5 [root@gyvm-4 data]# rm postmaster.pid  
6 rm: remove regular file `postmaster.pid'? y  
7 [root@gyvm-4 data]# service cloudera-scm-server-db status  
8 pg_ctl: no server running  

再次开启server-db,成功,启动server,成功。

1 [root@gyvm-4 data]# service cloudera-scm-server-db start  
2 DB initialization done.  
3 waiting for server to start.... done  
4 server started  
5 [root@gyvm-4 data]# service cloudera-scm-server start  
6 Starting cloudera-scm-server:                              [  OK  ]  

【结论】

  究其原因,是cloudera-server-db没有正常启动,但是残留了pid文件postmaster.pid,所以查看cloudera-server-db状态时,显示有误,返回cloudera-server-db是启动的状态。在此基础上,每次启动cloudera-server就会失败。

转自:http://blog.csdn.net/c1990/article/details/54706330