gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 20:49:59 25 4
gpt4 key购买 nike

大家好,

我一直在尝试使用sqoop在hdfs中加载数据,因为我写了一个shell脚本,我能够使用命令提示符执行导入,但是在运行该脚本时会失败。以下是该脚本

#!/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

最佳答案

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

关于hadoop - manager.SqlManager:执行语句时出错:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46262183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com