CDH5之Unexpected error.Unable to verify database connection

hackeruncle發表於2016-02-11
 在部署好CDH5(HDFS+MapReduce+Zookeeper)後,某一天想要透過web介面來新增Hive或者Oozie服務。
 新增Hive元件服務:
1.報錯:Unexpected error.Unable to verify database connection
CDH5之Unexpected error.Unable to verify database connection
2.解決辦法(曲線救國的辦法):
 
a.先選hive的服務節點,從namenode節點改為cm節點,這樣就會在cm節點上建立角色
 b.等部署完畢
 c.進hive tab頁,遷移角色或者刪除角色,重新新增

 新增Oozie元件服務:
1.又報錯:Unexpected error.Unable to verify database connection
CDH5之Unexpected error.Unable to verify database connection
2.解決辦法(根源方法)

CDH5之Unexpected error.Unable to verify database connection

[root@hadoopdn-04 ~]# tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
2016-02-09 13:20:44,062 INFO 67058165@scm-web-132:com.cloudera.server.cmf.cluster.RulesCluster: Done with service and role creation
2016-02-09 13:21:25,474 INFO 1079246313@scm-web-136:com.cloudera.cmf.service.ServiceHandlerRegistry: Executing host command OozieTestDatabaseConnection BasicCmdArgs{args=[hadoopnn-01, mysql, hadoopdn-04, oozie, oozie, oozie_password]}. Host: DbHost{id=1, hostId=4f4999cd-42fd-4f9f-949e-c9581ed98d7f, hostName=hadoopnn-01}
2016-02-09 13:21:25,667 WARN 264839353@agentServer-98:com.cloudera.server.cmf.AgentProtocolImpl: Received Process Heartbeat for unknown (or duplicate) process. Ignoring. This is expected to happen once after old process eviction or process deletion (as happens in restarts).id=775 name=null host=4f4999cd-42fd-4f9f-949e-c9581ed98d7f/hadoopnn-01
2016-02-09 13:21:27,380 INFO CommandPusher:com.cloudera.cmf.service.AbstractOneOffHostCommand: Unsuccessful 'OozieTestDatabaseConnection'
2016-02-09 13:21:27,381 INFO CommandPusher:com.cloudera.cmf.service.AbstractDbConnectionTestCommand: Command exited with code: 1
2016-02-09 13:21:27,381 INFO CommandPusher:com.cloudera.cmf.service.AbstractDbConnectionTestCommand: + local MISCJAVA_HOME_CANDIDATES
+ case ${BIGTOP_JAVA_MAJOR} in
+ JAVA_HOME_CANDIDATES=(${JAVA7_HOME_CANDIDATES[@]} ${JAVA8_HOME_CANDIDATES[@]} ${JAVA6_HOME_CANDIDATES[@]} ${MISCJAVA_HOME_CANDIDATES[@]} ${OPENJAVA7_HOME_CANDIDATES[@]} ${OPENJAVA8_HOME_CANDIDATES[@]} ${OPENJAVA6_HOME_CANDIDATES[@]})
+ '[' -z '' ']'
+ for candidate_regex in '${JAVA_HOME_CANDIDATES[@]}'
++ ls -rvd /usr/java/jdk1.7.0_40 /usr/java/jdk1.7.0_67-cloudera
+ for candidate in '`ls -rvd ${candidate_regex}* 2>/dev/null`'
+ '[' -e /usr/java/jdk1.7.0_67-cloudera/bin/java ']'
+ export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
+ JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
+ break 2
+ verify_java_home
+ '[' -z /usr/java/jdk1.7.0_67-cloudera ']'
+ echo JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
+ source_parcel_environment
+ '[' '!' -z '' ']'
+ JAVA=/usr/java/jdk1.7.0_67-cloudera/bin/java
+ [[ -z /usr/share/cmf ]]
+ MGMT_CLASSPATH='/usr/share/cmf/lib/*'
+ JDBC_JARS=/usr/share/java/mysql-connector-java.jar:/usr/share/cmf/lib/postgresql-jdbc.jar:/usr/share/java/oracle-connector-java.jar
+ MGMT_CLASSPATH='/usr/share/java/mysql-connector-java.jar:/usr/share/cmf/lib/postgresql-jdbc.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/lib/*'
++ pwd
+ MGMT_CLASSPATH='/var/run/cloudera-scm-agent/process/795-OOZIE.OOZIE_SERVER-test-db-connection:/usr/share/java/mysql-connector-java.jar:/usr/share/cmf/lib/postgresql-jdbc.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/lib/*'
+ MGMT_JAVA_OPTS='-Djava.net.preferIPv4Stack=true '
+ exec /usr/java/jdk1.7.0_67-cloudera/bin/java -Djava.net.preferIPv4Stack=true -Djava.security.egd=file:///dev/urandom -cp '/var/run/cloudera-scm-agent/process/795-OOZIE.OOZIE_SERVER-test-db-connection:/usr/share/java/mysql-connector-java.jar:/usr/share/cmf/lib/postgresql-jdbc.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/lib/*' com.cloudera.enterprise.dbutil.DbCommandExecutor db.properties
Error: Could not find or load main class com.cloudera.enterprise.dbutil.DbCommandExecutor
###################################################################################################################################
當前情況:在hadoopnn-01(namenode)部署Oozie服務,而資料庫在hadoopdn-04(cm)上(使用mysql資料庫).

分析以下這句報錯及圖01(報錯資訊太過模糊,無法準確定位錯誤,所以還是要善於使用 tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log):
+ exec /usr/java/jdk1.7.0_67-cloudera/bin/java -Djava.net.preferIPv4Stack=true -Djava.security.egd=file:///dev/urandom -cp '/var/run/cloudera-scm-agent/process/795-OOZIE.OOZIE_SERVER-test-db-connection:/usr/share/java/mysql-connector-java.jar:/usr/share/cmf/lib/postgresql-jdbc.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/lib/*' com.cloudera.enterprise.dbutil.DbCommandExecutor db.properties

經過分析驗證:
1. /usr/share/java/mysql-connector-java.jar 路徑存在(網上好多報該錯誤時,給的是這個mysql-connector-java.jar沒有在相應路徑配置,純屬瞎扯淡。假如沒有這個jar,報錯就不是這個錯誤了,會非常明顯的)
2. /usr/share/cmf/lib/* ,該路徑不存在,因為這個 cmf/lib/* 是部署在cm機器上的,只要對應的從cm機器scp到hadoopnn-01機器的相同路徑即可

點選(此處)摺疊或開啟

  1. [root@hadoopnn-01 ~]# cd /usr/share/
  2. [root@hadoopnn-01 share]# mkdir -p cmf/lib
  3. [root@hadoopdn-04 ~]# scp /usr/share/cmf/lib/* root@hadoopnn-01:/usr/share/cmf/lib
然後,在去驗證與mysql是否連線上,如圖02(Successful)。
CDH5之Unexpected error.Unable to verify database connection

備註: 之前我單獨新增hive服務時,也是這個錯誤,只不過當時採取了一種曲線救國的方式。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30089851/viewspace-1987886/,如需轉載,請註明出處,否則將追究法律責任。

相關文章