Oozie时出现Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure?
不多说,直接上干货!
问题详情
[hadoop@bigdatamaster oozie-4.1.-cdh5.5.4]$ bin/ooziedb.sh create -sqlfile oozie.sql -run DB Connection

[hadoop@bigdatamaster oozie-4.1.-cdh5.5.4]$ bin/ooziedb.sh create -sqlfile oozie.sql -run DB Connection
setting CATALINA_OPTS="$CATALINA_OPTS -Xmx1024m" Validate DB Connection Error: Could not connect to the database: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was milliseconds ago. The driver has not received any packets from the server. Stack trace for the error was (for debug purposes):
--------------------------------------
java.lang.Exception: Could not connect to the database: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was milliseconds ago. The driver has not received any packets from the server.
at org.apache.oozie.tools.OozieDBCLI.validateConnection(OozieDBCLI.java:)
at org.apache.oozie.tools.OozieDBCLI.createDB(OozieDBCLI.java:)
at org.apache.oozie.tools.OozieDBCLI.run(OozieDBCLI.java:)
at org.apache.oozie.tools.OozieDBCLI.main(OozieDBCLI.java:)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:)
at java.lang.reflect.Constructor.newInstance(Constructor.java:)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:)
at java.lang.reflect.Constructor.newInstance(Constructor.java:)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:)
at java.sql.DriverManager.getConnection(DriverManager.java:)
at java.sql.DriverManager.getConnection(DriverManager.java:)
at org.apache.oozie.tools.OozieDBCLI.createConnection(OozieDBCLI.java:)
at org.apache.oozie.tools.OozieDBCLI.validateConnection(OozieDBCLI.java:)
... more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:)
at java.net.Socket.connect(Socket.java:)
at java.net.Socket.connect(Socket.java:)
at java.net.Socket.<init>(Socket.java:)
at java.net.Socket.<init>(Socket.java:)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:)
... more
--------------------------------------
解决办法
分析1: 是否你是mysql服务进程么开启。
比如我的mysql是在root用户下安装的,且安装目录是在/home/hadoop下。当然大家可以将mysql服务进程设置为开机启动。
分析2:还有,是不是你的oozie用户下的主机,没有在数据库列表里。


<property>
<name>oozie.db.schema.name</name>
<value>oozie</value>
<description>
Oozie DataBase Name
</description>
</property>
<property>
<name>oozie.service.JPAService.create.db.schema</name>
<value>false</value>
<description>
Creates Oozie DB.
If set to true, it creates the DB schema if it does not exist. If the DB schema exists is a NOP.
If set to false, it does not create the DB schema. If the DB schema does not exist it fails start up.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.driver</name>
<value>com.mysql.jdbc.Driver</value>
<description>
JDBC driver class.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.url</name>
<value>jdbc:mysql://bigdatamaster:3306/oozie?createDatabaseIfNotExist=true</value>
<description>
JDBC URL.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.username</name>
<value>oozie</value>
<description>
DB user name.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.password</name>
<value>oozie</value>
<description>
DB user password.
IMPORTANT: if password is emtpy leave a space string, the service trims the value,
if empty Configuration assumes it is NULL.
</description>
</property>
因为,也许你会像我这样,之前在$OOZIE_HOME/conf/下的oozie-site.xml里,已经配置好了。
但是呢,忘记设置了。

[root@bigdatamaster hadoop]# mysql -uroot -p
Enter password: (默认回车)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.1. Source distribution Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select user,host,password from mysql.user;
+------+---------------+-------------------------------------------+
| user | host | password |
+------+---------------+-------------------------------------------+
| root | localhost | |
| root | bigdatamaster | |
| root | 127.0.0.1 | |
| | localhost | |
| | bigdatamaster | |
| hive | % | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
| hive | bigdatamaster | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
| hive | localhost | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
+------+---------------+-------------------------------------------+
rows in set (0.00 sec) mysql>
那么,现在,我们开启它。

mysql> create user 'oozie'@'%' identified by 'oozie';
Query OK, rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* to 'oozie'@'%' IDENTIFIED BY 'oozie' WITH GRANT OPTION;
Query OK, rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* to 'oozie'@'bigdatamaster' IDENTIFIED BY 'oozie' WITH GRANT OPTION;
Query OK, rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* to 'oozie'@'localhost' IDENTIFIED BY 'oozie' WITH GRANT OPTION;
Query OK, rows affected (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.00 sec) mysql> select user,host,password from mysql.user;
+-------+---------------+-------------------------------------------+
| user | host | password |
+-------+---------------+-------------------------------------------+
| root | localhost | |
| root | bigdatamaster | |
| root | 127.0.0.1 | |
| | localhost | |
| | bigdatamaster | |
| hive | % | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
| hive | bigdatamaster | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
| hive | localhost | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
| oozie | % | *2B03FE0359FAD3B80620490CE614F8622E0828CD |
| oozie | bigdatamaster | *2B03FE0359FAD3B80620490CE614F8622E0828CD |
| oozie | localhost | *2B03FE0359FAD3B80620490CE614F8622E0828CD |
+-------+---------------+-------------------------------------------+
rows in set (0.00 sec)
mysql> exit;
Bye
[root@bigdatamaster hadoop]#

[hadoop@bigdatamaster oozie-4.1.-cdh5.5.4]$ bin/ooziedb.sh create -sqlfile oozie.sql -run DB Connection
setting CATALINA_OPTS="$CATALINA_OPTS -Xmx1024m" Validate DB Connection
DONE
Check DB schema does not exist
DONE
Check OOZIE_SYS table does not exist
DONE
Create SQL schema
DONE
Create OOZIE_SYS table
DONE Oozie DB has been created for Oozie version '4.1.0-cdh5.5.4' The SQL commands have been written to: oozie.sql

[hadoop@bigdatamaster oozie-4.1.-cdh5.5.4]$ pwd
/home/hadoop/app/oozie-4.1.-cdh5.5.4
[hadoop@bigdatamaster oozie-4.1.-cdh5.5.4]$ ls
bin docs libext LICENSE.txt NOTICE.txt oozie-core oozie-hadooplibs-4.1.-cdh5.5.4.tar.gz oozie-sharelib-4.1.-cdh5.5.4.tar.gz oozie.sql release-log.txt
conf lib libtools logs oozie-4.1.-cdh5.5.4 oozie-examples.tar.gz oozie-server oozie-sharelib-4.1.-cdh5.5.4-yarn.tar.gz oozie.war src
[hadoop@bigdatamaster oozie-4.1.-cdh5.5.4]$
成功!
然后呢,大家也许还会出现如下问题:
Oozie安装时放置Mysql驱动包的总结(网上最全)
Oozie时出现org.apache.oozie.service.ServiceException: E0103: Could not load service classes, Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
Oozie时bin/oozied.sh start或bin/oozied.sh run出现Bootstrap进程无法启动,http://bigdatamaster:11000/oozie界面也无法打开?E0103: Could not load service classes,
java.lang.ClassNotFoundException: Class org.apache.oozie.ser
Oozie时bin/oozied.sh start或bin/oozied.sh run出现Bootstrap进程无法启动,http://bigdatamaster:11000/oozie界面也无法打开?
Oozie时出现Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure?
Oozie时出现Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0?
CDH版本的oozie安装执行bin/oozie-setup.sh prepare-war,没生成oozie.war?
Oozie时出现Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure?的更多相关文章
- Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
很长的报错,截取 ERROR c.a.d.p.DruidDataSource - discard connection com.mysql.jdbc.exceptions.jdbc4.Comm ...
- 异常解决:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
异常描述 这个异常通常有如下信息: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failu ...
- sqoop从mysql导数据到hive报错:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
背景 使用sqoop从mysql导数据到hive,从本地服务器是可以访问mysql的(本地服务器是hadoop集群的一个datanode),但是sqoop导数据的时候依然连接不上mysql 报错如下: ...
- Caused by: java.net.ConnectException: Connection refused/Caused by: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
1.使用sqoop技术将mysql的数据导入到Hive出现的错误如下所示: 第一次使用命令如下所示: [hadoop@slaver1 sqoop--cdh5.3.6]$ bin/sqoop impor ...
- org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent succ
数据库 没有开启 连接失败 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause ...
- troubshooting-sqoop 导出 TiDB表数据报com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
2019-11-22 17:15:27,705 FATAL [IPC Server handler 13 on 44844] org.apache.hadoop.mapred.TaskAttemptL ...
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 数据库报错
-- 查询mysql 数据库链接空闲时间持有最大空闲时间,单位为秒 SHOW VARIABLES WHERE VAriable_name = 'interactive_timeout'; -- 会出现 ...
- 问题记录——com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
最近在搞一个Spring boot + Mybatis + Mysql的项目,用Mybatis访问数据库时,报了如下的错误,先在网上搜索了,试了各种办法都不行, 奇葩的是,连接另外1个数据库又没问题. ...
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决办法
09:00:30.307 [http-8080-6] ERROR org.hibernate.transaction.JDBCTransaction -JDBC begin failed com.my ...
随机推荐
- sql 经典面试题
如果数据库里两个日期型字段d1,d2,怎样用sql语句列出按月的所有区间,比如表结构如下localid d1 d21 2014-1-15 2014-3- ...
- Unable to find 'struts.multipart.saveDir' property setting.
今天在项目开发中遇到如下问题 项目使用的是struts2 Unable to find 'struts.multipart.saveDir' property setting. 后来在网上查询特此记录 ...
- Java web中常见编码乱码问题(二)
根据上篇记录Java web中常见编码乱码问题(一), 接着记录乱码案例: 案例分析: 2.输出流写入内容或者输入流读取内容时乱码(内容中有中文) 原因分析: a. 如果是按字节写入或读取时乱码, ...
- 脑洞大开--一条项目中常用的linux命令引发的经典算法题
小时候家里定了<读者>的月刊,里面记录一个故事:说有有个偏僻的乡村一日突然来了一个美女,她携着万贯家财子女在当地安家落户,成了当地的乡绅.她让她的子女世世代代的保守这个秘密,直到这个秘密不 ...
- if中可以使用那些作为判断条件呢?
在所有编程语言中if是最长用的判断之一,但在js中到底哪些东西可以在if中式作为判断表达式呢? 例如如何几行,只是少了一个括号,真假就完全不同,到底表示什么含义呢 ? 1 2 3 4 5 6 7 8 ...
- java基础之IO篇
IO流 在计算机中的流是有方向的即为IO流,分为输入流和输出流,他们的方向都是以服务的方向为主,向服务器中发送指令等等就是输出流,服务器给出的反应等等,我们都说为输出流. 字节流 字符流 输入流 In ...
- Hibernate入门(三)
一 Hibernate生成器类 Hibernate中,标签id中的generator标签用于生成持久化类对象的唯一标识.所有的生成器类都实现了org.hibernate.id.IdentifierGe ...
- 深入理解 JavaScript 事件循环(一)— event loop
引言 相信所有学过 JavaScript 都知道它是一门单线程的语言,这也就意味着 JS 无法进行多线程编程,但是 JS 当中却有着无处不在的异步概念 .在初期许多人会把异步理解成类似多线程的编程模式 ...
- react-native-fs插件的使用以及遇到的坑
react-native-fs插件是文件对上传和下载时使用的,iOS和android都可使用,File upload (iOS only). 安装命令: npm install react-nativ ...
- 关于MATLAB处理大数据坐标文件201762
经过头脑风暴法想出了很多特征,目前经过筛选已经提交了两次数据,数据提交结果不尽如人意,但是收获很大. 接下来继续提取特征,特征数达到27时筛选出20条特征,并找出最佳搭配