Sqoop Installation Configuration Tutorial

Source: Internet
Author: User
Tags create database sqoop accumulo

1. Install the deployment
(1), download address: http://archive.cloudera.com/cdh5/cdh/5/sqoop-1.4.6-cdh5.5.2.tar.gz
Unzip to/home/neil/downloads/hadoop-2.7.3/sqoop-1.4.6
(2), copy the MySQL JDBC driver package Mysql-connector-java-5.1.31-bin.jar to the Sqoop/lib directory.
(3), configuration environment variable sqoop

Export sqoop_home=/home/neil/downloads/hadoop-2.7.3/sqoop-1.4.6
Export Path= Path:path:sqoop_home/bin
(4), copy sqoop/conf/sqoop-env-template.sh to sqoop-env.sh
Add related configuration SetPath to where Bin/hadoop is available

exporthadoop_common_home=/home/neil/downloads/hadoop-2.7.3 SetPath to where Hadoop-*-core.jar isavailable

exporthadoop_mapred_home=/home/neil/downloads/hadoop-2.7.3 setthe path to where Bin/hbase isavailable

exporthbase_home=/opt/cdh5/hbase-1.1.8 setthe Path to where bin/hive is available

Exporthive_home=/home/neil/downloads/hadoop-2.7.3/hive-1.2.1 setthe path for where Zookeper config Diris

Exportzoocfgdir=/home/neil/downloads/hadoop-2.7.3/zookeeper-3.4.5
(5) Test Sqoop version
I found a warning.
Modify $sqoop_home/bin/configure-sqoop
Comment out the Hcatalog,accumulo check (unless you are ready to use components on Hadoop such as Hcatalog,accumulo) Moved to is a runtime check in Sqoop. if [!-D "${hcat_home}"]; Then echo "Warning: $HCAT _home does not exist! Hcatalog jobs willfail. " Echo ' please set $HCAT _home to the root of your hcatalog installation. ' fi if [!-D "${accumulo_home}"];then echo "Warning: $ACCUMULO _home does not exist! Accumulo imports Willfail. " Echo ' please set $ACCUMULO _home to the root of your accumuloinstallation. ' fi

Execute Sqoop version again
You can also view the instructions for using a command:
Sqoopimport–help sqoopimport–help sqoophelp Import

An example of Sqoop import is as follows:
Log in to MySQL
1.mysql-u root-p

2. Create Database hadoopguide;
Create Database hadoopguide;

Use Hadoopguide;

3. Create a table
CREATE table widgets (ID int not NULL PRIMARY key Auto_increment,widget_name varchar ($) Not null,price decimal (10,2), Desig N_date date,version int,design_comment varchar (100));

4. Insert several records
INSERT into widgets values (NULL, ' sprocket ', 0.25, ' 2010-02-10 ', 1, ' connects ' gizmos ');
INSERT into widgets values (null, ' Gizmo ', 4.00, ' 2009-02-10 ', 1,null);
INSERT into widgets values (NULL, ' sprocket ', 99.99, ' 2011-02-10 ', 1, ' our flagship product ');

5. Exit
Quit

6. Use Sqoop to import this table data to HDFs

$ sqoop import–connect jdbc:mysql://localhost:3306/hadoopguide–username Root–password neil–table Widgets

You can also use –options-file to pass in a file, and you can reuse some configuration parameters in this way:
$ sqoop–options-file/users/homer/work/import.txt–table TEST
The contents of the/users/homer/work/import.txt file are as follows:
Import
–connect
Jdbc:mysql://192.168.56.121:3306/metastore
–username
Hiveuser
–password
Redhat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.