Sqoop将MySQL的表数据同步到HDFS(三)设置压缩

系统环境

操作系统: CentOS 7
主机名:   centos02
IP:      192.168.122.1
Java:    1.8
Hadoop:  2.8.5
Sqoop:   1.4.7
MySQL: 8.0.12

 

一、GZIP 压缩(默认压缩编码器)

sqoop import 
--connect jdbc:mysql://centos02:3306/OfficialCashMid 
--driver com.mysql.cj.jdbc.Driver 
--username root 
--password sa123_ADMIN. 
--table tadminoperationlog 
--m 2 
--target-dir /jdbcHDFS/TAdminLog_txt_gzip 
--compress  
--fields-terminated-by '\t' 
[root@centos02 bin]# sqoop import --connect jdbc:mysql://centos02:3306/OfficialCashMid --driver com.mysql.cj.jdbc.Driver --username root --password sa123_ADMIN. --table tadminoperationlog --m 2 --target-dir /jdbcHDFS/TAdminLog_txt_gzip --compress  --fields-terminated-by '\t' 
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
19/09/04 01:22:16 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
19/09/04 01:22:16 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
19/09/04 01:22:17 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
19/09/04 01:22:17 INFO manager.SqlManager: Using default fetchSize of 1000
19/09/04 01:22:17 INFO tool.CodeGenTool: Beginning code generation
19/09/04 01:22:18 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM tadminoperationlog AS t WHERE 1=0
19/09/04 01:22:18 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM tadminoperationlog AS t WHERE 1=0
19/09/04 01:22:18 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /opt/bigdata/hadoop/hadoop-2.8.5
注: /tmp/sqoop-root/compile/b8a172b05beb1f32ae8d6ad3014199ec/tadminoperationlog.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
19/09/04 01:22:21 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-root/compile/b8a172b05beb1f32ae8d6ad3014199ec/tadminoperationlog.jar
19/09/04 01:22:21 INFO mapreduce.ImportJobBase: Beginning import of tadminoperationlog
19/09/04 01:22:21 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
19/09/04 01:22:21 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM tadminoperationlog AS t WHERE 1=0
19/09/04 01:22:22 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
19/09/04 01:22:23 INFO client.RMProxy: Connecting to ResourceManager at centos02/192.168.122.1:8032
19/09/04 01:22:30 INFO db.DBInputFormat: Using read commited transaction isolation
19/09/04 01:22:30 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(FID), MAX(FID) FROM tadminoperationlog
19/09/04 01:22:30 INFO db.IntegerSplitter: Split size: 16058; Num splits: 2 from: 21 to: 32138
19/09/04 01:22:31 INFO mapreduce.JobSubmitter: number of splits:2
19/09/04 01:22:31 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1567503661837_0007
19/09/04 01:22:32 INFO impl.YarnClientImpl: Submitted application application_1567503661837_0007
19/09/04 01:22:32 INFO mapreduce.Job: The url to track the job: http://centos02:8088/proxy/application_1567503661837_0007/
19/09/04 01:22:32 INFO mapreduce.Job: Running job: job_1567503661837_0007
19/09/04 01:22:46 INFO mapreduce.Job: Job job_1567503661837_0007 running in uber mode : false
19/09/04 01:22:46 INFO mapreduce.Job:  map 0% reduce 0%
19/09/04 01:22:57 INFO mapreduce.Job:  map 50% reduce 0%
19/09/04 01:22:58 INFO mapreduce.Job:  map 100% reduce 0%
19/09/04 01:22:59 INFO mapreduce.Job: Job job_1567503661837_0007 completed successfully
19/09/04 01:22:59 INFO mapreduce.Job: Counters: 30
    File System Counters
        FILE: Number of bytes read=0
        FILE: Number of bytes written=357718
        FILE: Number of read operations=0
        FILE: Number of large read operations=0
        FILE: Number of write operations=0
        HDFS: Number of bytes read=206
        HDFS: Number of bytes written=154754
        HDFS: Number of read operations=8
        HDFS: Number of large read operations=0
        HDFS: Number of write operations=4
    Job Counters 
        Launched map tasks=2
        Other local map tasks=2
        Total time spent by all maps in occupied slots (ms)=18767
        Total time spent by all reduces in occupied slots (ms)=0
        Total time spent by all map tasks (ms)=18767
        Total vcore-milliseconds taken by all map tasks=18767
        Total megabyte-milliseconds taken by all map tasks=19217408
    Map-Reduce Framework
        Map input records=12122
        Map output records=12122
        Input split bytes=206
        Spilled Records=0
        Failed Shuffles=0
        Merged Map outputs=0
        GC time elapsed (ms)=1295
        CPU time spent (ms)=8910
        Physical memory (bytes) snapshot=386605056
        Virtual memory (bytes) snapshot=4272398336
        Total committed heap usage (bytes)=201326592
    File Input Format Counters 
        Bytes Read=0
    File Output Format Counters 
        Bytes Written=154754
19/09/04 01:22:59 INFO mapreduce.ImportJobBase: Transferred 151.127 KB in 36.9687 seconds (4.088 KB/sec)
19/09/04 01:22:59 INFO mapreduce.ImportJobBase: Retrieved 12122 records.
[root@centos02 bin]# 

 

二、Snappy 压缩

sqoop import 
--connect jdbc:mysql://centos02:3306/OfficialCashMid 
--driver com.mysql.cj.jdbc.Driver 
--username root 
--password sa123_ADMIN. 
--table tadminoperationlog 
--m 2 
--target-dir /jdbcHDFS/TAdminLog_txt_snappy 
--compress 
--compression-codec org.apache.hadoop.io.compress.SnappyCodec  
--fields-terminated-by '\t'  
[root@centos02 bin]# sqoop import --connect jdbc:mysql://centos02:3306/OfficialCashMid --driver com.mysql.cj.jdbc.Driver --username root --password sa123_ADMIN. --table tadminoperationlog --m 2 --target-dir /jdbcHDFS/TAdminLog_txt_snappy --compress --compression-codec org.apache.hadoop.io.compress.SnappyCodec  --fields-terminated-by '\t' 
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /opt/bigdata/sqoop/sqoop-1.4.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
19/09/04 01:32:14 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
19/09/04 01:32:14 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
19/09/04 01:32:14 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
19/09/04 01:32:14 INFO manager.SqlManager: Using default fetchSize of 1000
19/09/04 01:32:14 INFO tool.CodeGenTool: Beginning code generation
19/09/04 01:32:16 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM tadminoperationlog AS t WHERE 1=0
19/09/04 01:32:16 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM tadminoperationlog AS t WHERE 1=0
19/09/04 01:32:16 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /opt/bigdata/hadoop/hadoop-2.8.5
注: /tmp/sqoop-root/compile/af712eaf4c137b07c33ec387e44fbbd0/tadminoperationlog.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
19/09/04 01:32:18 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-root/compile/af712eaf4c137b07c33ec387e44fbbd0/tadminoperationlog.jar
19/09/04 01:32:18 INFO mapreduce.ImportJobBase: Beginning import of tadminoperationlog
19/09/04 01:32:18 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
19/09/04 01:32:18 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM tadminoperationlog AS t WHERE 1=0
19/09/04 01:32:20 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
19/09/04 01:32:20 INFO client.RMProxy: Connecting to ResourceManager at centos02/192.168.122.1:8032
19/09/04 01:32:27 INFO db.DBInputFormat: Using read commited transaction isolation
19/09/04 01:32:27 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(FID), MAX(FID) FROM tadminoperationlog
19/09/04 01:32:27 INFO db.IntegerSplitter: Split size: 16058; Num splits: 2 from: 21 to: 32138
19/09/04 01:32:28 INFO mapreduce.JobSubmitter: number of splits:2
19/09/04 01:32:28 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1567503661837_0008
19/09/04 01:32:29 INFO impl.YarnClientImpl: Submitted application application_1567503661837_0008
19/09/04 01:32:29 INFO mapreduce.Job: The url to track the job: http://centos02:8088/proxy/application_1567503661837_0008/
19/09/04 01:32:29 INFO mapreduce.Job: Running job: job_1567503661837_0008
19/09/04 01:32:40 INFO mapreduce.Job: Job job_1567503661837_0008 running in uber mode : false
19/09/04 01:32:40 INFO mapreduce.Job:  map 0% reduce 0%
19/09/04 01:33:18 INFO mapreduce.Job:  map 100% reduce 0%
19/09/04 01:33:20 INFO mapreduce.Job: Job job_1567503661837_0008 completed successfully
19/09/04 01:33:20 INFO mapreduce.Job: Counters: 30
    File System Counters
        FILE: Number of bytes read=0
        FILE: Number of bytes written=357726
        FILE: Number of read operations=0
        FILE: Number of large read operations=0
        FILE: Number of write operations=0
        HDFS: Number of bytes read=206
        HDFS: Number of bytes written=353086
        HDFS: Number of read operations=8
        HDFS: Number of large read operations=0
        HDFS: Number of write operations=4
    Job Counters 
        Launched map tasks=2
        Other local map tasks=2
        Total time spent by all maps in occupied slots (ms)=70808
        Total time spent by all reduces in occupied slots (ms)=0
        Total time spent by all map tasks (ms)=70808
        Total vcore-milliseconds taken by all map tasks=70808
        Total megabyte-milliseconds taken by all map tasks=72507392
    Map-Reduce Framework
        Map input records=12122
        Map output records=12122
        Input split bytes=206
        Spilled Records=0
        Failed Shuffles=0
        Merged Map outputs=0
        GC time elapsed (ms)=382
        CPU time spent (ms)=14060
        Physical memory (bytes) snapshot=374837248
        Virtual memory (bytes) snapshot=4287746048
        Total committed heap usage (bytes)=192937984
    File Input Format Counters 
        Bytes Read=0
    File Output Format Counters 
        Bytes Written=353086
19/09/04 01:33:20 INFO mapreduce.ImportJobBase: Transferred 344.8105 KB in 60.7307 seconds (5.6777 KB/sec)
19/09/04 01:33:20 INFO mapreduce.ImportJobBase: Retrieved 12122 records.
[root@centos02 bin]# 

 

posted @ 2019-09-05 01:13  茗::流  阅读(482)  评论(0)    收藏  举报
如有雷同,纯属参考。如有侵犯你的版权,请联系我。