与azkaban连接时出现MySql错误“无法创建PoolableConnectionFactory(无法创建与数据库服务器的连接。)”?

时间:2020-04-13 13:05:06

标签: java mysql azkaban

我正在尝试将Azkaban(hadoop的作业调度程序)与本地mysql连接。 Azkaban的配置文件如下:

database.type=mysql
mysql.port=3306
mysql.host=localhost
mysql.database=azkaban

#Changed by Prakhar for azkaban , Azkaban
mysql.user=root
mysql.password= [ Password of mysql ]

MyMySql有一个名为“ azkaban”的数据库,我可以使用以下命令登录mysql:

./mysql -u root -p

我也验证了mysql正在3306端口上工作。 仍然我无法连接到mysql。 azkaban的日志如下所示:

2020/04/11 22:38:05.584 +0530 ERROR [MySQLDataSource] [Azkaban] Failed to find write-enabled DB connection. Wait 15 seconds and retry. No.Attempt = 1
java.sql.SQLException: Cannot create PoolableConnectionFactory (Could not create connection to database server.)
    at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294)
    at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
    at azkaban.db.MySQLDataSource.getConnection(MySQLDataSource.java:76)
    at org.apache.commons.dbutils.AbstractQueryRunner.prepareConnection(AbstractQueryRunner.java:175)
    at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:286)
    at azkaban.db.DatabaseOperator.query(DatabaseOperator.java:68)
    at azkaban.executor.ExecutorDao.fetchActiveExecutors(ExecutorDao.java:53)
    at azkaban.executor.JdbcExecutorLoader.fetchActiveExecutors(JdbcExecutorLoader.java:266)
    at azkaban.executor.ExecutorManager.setupExecutors(ExecutorManager.java:223)
    at azkaban.executor.ExecutorManager.<init>(ExecutorManager.java:131)
    at azkaban.executor.ExecutorManager$$FastClassByGuice$$e1c1dfed.newInstance(<generated>)
    at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
    at 

1 个答案:

答案 0 :(得分:0)

很少有指针可以帮助您解决问题。

  1. 请检查安装的MySQL版本与用于构建Azkaban的Gradle文件中提到的MySQL客户端
  2. 最好使用MySQL 5.x版本
  3. 确保安装兼容的客户端版本
  4. 此外,在启动Web执行程序之前在数据库中创建Mysql表