sqoop job operation and how to omit entering password when executing job

1.  Create Job

Description: When creating a Job, use the --password-file parameter and not --passoword. The main reason is that using the --password parameter when executing a Job will have a warning and require a password to execute the Job. When we use the --password-file parameter, the database password is not required to execute the Job.

 sqoop  job --create etl_sync_job -- import --connect jdbc:mysql://10.96.3.8:3306/lOT_DMPS --username galera --password-file /data/cdh/hive/hiveExternal/sqoopMysqlTest.pwd  --table test_etl --target-dir '/data/cdh/hive/hiveExternal/TEST_ETL' --check-column id --incremental append --last-value 1 --null-string '\\N' --null-non-string '\\N' --fields-terminated-by '\001' --lines-terminated-by '\n' -m 1

2. Create a password-file file

Note: sqoop stipulates that the password file must be placed on HDFS, and the permission must be 400

(1)echo -n "123456" > sqoopMysqlTest.pwd
(2)hdfs dfs -put sqoopMysqlTest.pwd /data/cdh/hive/hiveExternal

(3)hdfs dfs -chmod 400 /data/cdh/hive/hiveExternal/sqoopMysqlTest.pwd

3. Execute job
sqoop job -exec etl_sync_job

4. Query job, mainly to check the value of the error reported after each execution in the incremental update field

sqoop job -show etl_sync_job

5. View job list

sqoop job --list

6. Delete job
sqoop job -delete etl_sync_job

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324854085&siteId=291194637