Sqoop user's manual-- mysql configuration
First execute on the virtual machine where the mysql database is installed
Mysql-u root-p
The password for entering sql is empty.
Create database stock
Grant all privileges on. To root@localhost identified by 'transwarp'
Flush privileges; / / refresh the system permissions table
Then execute:
Assign all permissions to the three hosts in the cluster in MySQL and ensure that the authorization operation has taken effect
Grant all privileges on. To root@10.233.40.107 identified by '123456'
Grant all privileges on. To root@10.233.40.108 identified by '123456'
Grant all privileges on. To root@10.233.40.109 identified by '123456'
Flush privileges
Next, create the table in mysql's stock database and create the data in the table.
Install sqoop with yum
Yum install sqoop
All default (only one needs to be installed on a virtual machine, not all)
The sqoop help command can help us to use sqoop.
Next
Prepare the JDBC driver for Mysql (can only be used in sqoop1 experiments)
-copy the JDBC driver (mysql-connector-java-5.1.31.jar) to the / usr/lib/sqoop/lib directory
Find out where the driver of mysql is in linux
Find /-name mysql-connector-java-*
You will find out where the driver of mysql is, and then copy it to the / usr/lib/sqoop/lib directory.
And then use sqoop to import data between hdfs
See the textbook for details.