manager.SqlManager:执行语句时出错:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通讯链接失败

时间:2017-09-17 08:39:05

标签: hadoop sqoop

我大家好,

我一直在尝试使用sqoop在hdfs中加载数据,因为我编写了一个shell脚本,我可以使用命令提示符执行导入,但是当我运行脚本时它失败了.Below是脚本

#!/bin/bash
tablename=${1}
hdfspath=${2}
NOW=$(date +"%m-%d-%Y-%H-%M-%S")
echo "started at $NOW"
sqoop import \
  --connect jdbc:mysql://local/hadoopguide \
  --username root \
  --password cloudera \
  --table ${1} \
  --target-dir ${2}
END_T=$(date +"%m-%d-%Y-%H-%M-%S")
echo "end at $END_T"

以下是我得到的错误

17/09/17 01:07:26 ERROR manager.SqlManager: Error executing statement: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

1 个答案:

答案 0 :(得分:0)

问题是连接字符串正确的字符串是jdbc:mysql:// quickstart:3306 / hadoopguide