问题现象
查看
[root@cmbigdata1 cloudera-scm-server]# pwd /var/log/cloudera-scm-server [root@cmbigdata1 cloudera-scm-server]# cat cloudera-scm-server.log
是如下的问题:
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397) at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:62) at com.cloudera.enterprise.AbstractWrappedEntityManager.beginForRollbackAndReadonly(AbstractWrappedEntityManager.java:89) at com.cloudera.enterprise.dbutil.DbUtil.isInnoDbEnabled(DbUtil.java:549) at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.checkMysqlTableEngineType(EntityManagerFactoryBean.java:139) at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:122) at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:65) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142) ... 22 more Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:221) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160) at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1426) at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59) ... 28 more Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:84) at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) ... 33 more Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source. at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) ... 37 more 2017-12-02 19:59:55,633 INFO main:com.cloudera.server.cmf.Main: Starting SCM Server. JVM Args: [-Dlog4j.configuration=file:/etc/cloudera-scm-server/log4j.properties, -Dfile.encoding=UTF-8, -Dcmf.root.logger=INFO,LOGFILE, -Dcmf.log.dir=/var/log/cloudera-scm-server, -Dcmf.log.file=cloudera-scm-server.log, -Dcmf.jetty.threshhold=WARN, -Dcmf.schema.dir=/usr/share/cmf/schema, -Djava.awt.headless=true, -Djava.net.preferI
[root@cmbigdata1 lib]# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1262/rpcbind tcp 0 0 0.0.0.0:4433 0.0.0.0:* LISTEN 1976/python2.6 tcp 0 0 0.0.0.0:52338 0.0.0.0:* LISTEN 1390/rpc.statd tcp 0 0 127.0.0.1:7190 0.0.0.0:* LISTEN 1976/python2.6 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1579/sshd tcp 0 0 0.0.0.0:7191 0.0.0.0:* LISTEN 1976/python2.6 tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1417/cupsd tcp 0 0 127.0.0.1:19001 0.0.0.0:* LISTEN 1894/python tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1683/master tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2263/sshd tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 2689/sshd tcp 0 0 192.168.80.31:9000 0.0.0.0:* LISTEN 1739/python2.6 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3183/mysqld tcp 0 0 :::111 :::* LISTEN 1262/rpcbind tcp 0 0 :::4434 :::* LISTEN 1976/python2.6 tcp 0 0 :::22 :::* LISTEN 1579/sshd tcp 0 0 :::7191 :::* LISTEN 1976/python2.6 tcp 0 0 ::1:631 :::* LISTEN 1417/cupsd tcp 0 0 ::1:25 :::* LISTEN 1683/master tcp 0 0 :::59833 :::* LISTEN 1390/rpc.statd tcp 0 0 ::1:6010 :::* LISTEN 2263/sshd tcp 0 0 ::1:6011 :::* LISTEN 2689/sshd
解决办法
[root@cmbigdata1 lib]# service mysqld start
Starting mysqld: [ OK ]
[root@cmbigdata1 lib]#
[root@cmbigdata1 lib]# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:7180 0.0.0.0:* LISTEN 3309/java tcp 0 0 0.0.0.0:7182 0.0.0.0:* LISTEN 3309/java tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1262/rpcbind tcp 0 0 0.0.0.0:4433 0.0.0.0:* LISTEN 1976/python2.6 tcp 0 0 0.0.0.0:52338 0.0.0.0:* LISTEN 1390/rpc.statd tcp 0 0 127.0.0.1:7190 0.0.0.0:* LISTEN 1976/python2.6 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1579/sshd tcp 0 0 0.0.0.0:7191 0.0.0.0:* LISTEN 1976/python2.6 tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1417/cupsd tcp 0 0 127.0.0.1:19001 0.0.0.0:* LISTEN 1894/python tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1683/master tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2263/sshd tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 2689/sshd tcp 0 0 192.168.80.31:9000 0.0.0.0:* LISTEN 1739/python2.6 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3183/mysqld tcp 0 0 :::111 :::* LISTEN 1262/rpcbind tcp 0 0 :::4434 :::* LISTEN 1976/python2.6 tcp 0 0 :::22 :::* LISTEN 1579/sshd tcp 0 0 :::7191 :::* LISTEN 1976/python2.6 tcp 0 0 ::1:631 :::* LISTEN 1417/cupsd tcp 0 0 ::1:25 :::* LISTEN 1683/master tcp 0 0 :::59833 :::* LISTEN 1390/rpc.statd tcp 0 0 ::1:6010 :::* LISTEN 2263/sshd tcp 0 0 ::1:6011 :::* LISTEN 2689/sshd [root@cmbigdata1 lib]#
其实,这个问题很简单,是mysql方面的问题,要么是mysql服务没启动,要么就是你的驱动jar包没安装好。
[root@cmbigdata1 lib]# pwd /usr/share/cmf/lib [root@cmbigdata1 lib]#
建议
要将mysqld设置为开机自动启动:
chkconfig mysqld on
可能还会出现情况,就是JDBC driver cannot be found,这时把jar包复现到 /usr/share/cmf/lib 下就行了。
重启cloudera-scm-server服务。
等待1分钟,访问7180端口,应该就不会出问题了。