gpt4 book ai didi

mysql - Sqoop MySQL数据导入错误

转载 作者:行者123 更新时间:2023-12-02 22:06:21 24 4
gpt4 key购买 nike

我是Hadoop世界的新手。刚刚开始学习有关hadoop的新知识。
使用sqoop将数据从mysql导入到hdfs时出现以下错误:

sqoop:000> sqoop import --connect jdbc:mysql://localhost/books --username root --password thanks --table authors --m 1;
Exception has occurred during processing command
Exception: org.codehaus.groovy.control.MultipleCompilationErrorsException Message: startup failed:
groovysh_parse: 1: expecting EOF, found 'import' @ line 1, column 7.
sqoop import --connect jdbc:mysql://localhost/books --username root --password thanks --table authors --m 1;
^
1 error

您能帮我解决此错误吗?

最佳答案

看来您正在使用sqoop2

您需要按照以下步骤操作!

第一步
检查您是否正确安装了sqoop

sqoop:000> show version --all  

你应该得到这样的回应
Server version:   Sqoop 2.0.0-SNAPSHOT revision Unknown   Compiled by  
jarcec on Wed Nov 21 16:15:51 PST 2012 Client version: Sqoop
2.0.0-SNAPSHOT revision Unknown Compiled by jarcec on Wed Nov 21 16:15:51 PST 2012 Protocol version: [1]

第二步

检查Sqoop服务器上可用的连接器:
 sqoop:000> show connector --all 
1 connector(s) to show: Connector with
id 1:
Name: generic-jdbc-connector
Class:
org.apache.sqoop.connector.jdbc.GenericJdbcConnector
Supported job
types: [EXPORT, IMPORT]

第三步
sqoop:000> create connection --cid 1  
Creating connection for connector
with id 1
Please fill following values to create new connection object
Name: First connection

Configuration configuration
JDBC Driver Class: com.mysql.jdbc.Driver
JDBC Connection String: jdbc:mysql://mysql.server/database
Username: sqoop
Password: *****
JDBC Connection Properties: There are currently
0 values in the map: entry#

Security related configuration options Max connections: 0 New
connection was successfully created with validation status FINE and
persistent id 1

步骤4
现在创建一个导入数据的作业
最后,它还将要求提取器和装载器,将1都用作值。
sqoop:000> create job --xid 1 --type import  
Creating job for
connection with id 1 Please fill following values to create new job
object
Name: First job
Database configuration
Table name: users
Table SQL statement: Table
column names:
Partition column name:
Boundary query:

Output configuration
Storage type:
0 : HDFS Choose: 0
Output directory: /user/jarcec/users
New job was successfully created with
validation status FINE and persistent id 1

步骤5
现在开始工作
sqoop:000> start job --jid 1  

并导入您的数据

关于mysql - Sqoop MySQL数据导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25498251/

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