Hadoop数据导入导出:Flume日志采集与部署教程

需积分: 10 0 下载量 48 浏览量 更新于2024-07-15 收藏 2.18MB PDF 举报
在模块6的协同工作中,我们专注于Hadoop数据的导入导出,特别是使用Flume进行数据收集。Hadoop是一个强大的分布式计算框架,专为大数据处理设计,而Flume作为Cloudera提供的一个重要工具,它在分布式系统中的角色主要体现在海量日志的采集、聚合和传输上。 Sqoop是Hadoop生态系统中的另一个组件,主要用于在Hadoop和关系数据库之间进行数据迁移,无论是从数据库导入表到HDFS还是从HDFS导出到数据库,都需要预先规划和准备。而Flume的引入则解决了实时或批量收集外部日志数据的问题,尤其适用于实时监控和分析大规模的日志数据,如电子商务网站的用户行为数据。 Flume的核心功能包括: 1. 安装部署:掌握Flume的安装步骤是学习的基础,确保系统能够正确配置和运行。这涉及选择合适的Flume版本,比如0.9X版本(Flume-og)和1.X版本(Flume-ng),尽管Flume-ng进行了重构,但两者在使用时需有所区别。 2. 体系结构与工作原理:理解Flume的工作流程至关重要,它通常由数据源(Data Source)、通道(Channels)和sink(Sinks)三部分组成。数据源负责接收数据,通道存储和缓冲数据,而sink则将数据发送到最终目的地,如HDFS、HBase或其他系统。 3. 数据收集定制:Flume支持自定义数据发送方,可以根据具体需求选择不同的方式收集数据,例如从控制台、RPC接口、文本文件或TCP/IP套接字接收数据。 4. 数据处理与写入:Flume不仅负责数据的收集,还具备基本的数据处理能力,可以对收集到的数据进行简单的预处理,然后将其写入到可定制的接收方,这为后续的数据分析和挖掘提供了基础。 5. 高可用性和可靠性:Flume设计时注重高可用性,即使在某些组件故障的情况下也能保证数据的连续性和完整性。这对于处理大规模日志数据的场景来说尤为重要。 通过学习和实践Flume,开发者可以有效地集成外部数据流到Hadoop生态系统中,为大数据分析提供实时且高效的支持。这在现代企业的数据驱动决策中发挥着关键作用。

2023-06-10 06:10:14,356 INFO mapreduce.Job: Job job_1686300831839_0056 failed with state FAILED due to: Task failed task_1686300831839_0056_m_000001 Job failed as tasks failed. failedMaps:1 failedReduces:0 killedMaps:0 killedReduces: 0 2023-06-10 06:10:14,536 INFO mapreduce.Job: Counters: 9 Job Counters Failed map tasks=1 Killed map tasks=3 Launched map tasks=4 Data-local map tasks=4 Total time spent by all maps in occupied slots (ms)=20374 Total time spent by all reduces in occupied slots (ms)=0 Total time spent by all map tasks (ms)=20374 Total vcore-milliseconds taken by all map tasks=20374 Total megabyte-milliseconds taken by all map tasks=20862976 2023-06-10 06:10:14,561 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead 2023-06-10 06:10:14,566 INFO mapreduce.ExportJobBase: Transferred 0 bytes in 19.7479 seconds (0 bytes/sec) 2023-06-10 06:10:14,582 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead 2023-06-10 06:10:14,582 INFO mapreduce.ExportJobBase: Exported 0 records. 2023-06-10 06:10:14,582 ERROR mapreduce.ExportJobBase: Export job failed! 2023-06-10 06:10:14,585 ERROR tool.ExportTool: Error during export: Export job failed! at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:445) at org.apache.sqoop.manager.SqlManager.exportTable(SqlManager.java:931) at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:80) at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:99) at org.apache.sqoop.Sqoop.run(Sqoop.java:147) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243) at org.apache.sqoop.Sqoop.main(Sqoop.java:252)

2023-06-11 上传

Warning: No configuration directory set! Use --conf <dir> to override. Info: Including Hadoop libraries found via (/opt/hadoop-3.1.2/bin/hadoop) for HDFS access Info: Including HBASE libraries found via (/opt/hbase-2.2.6/bin/hbase) for HBASE access 错误: 找不到或无法加载主类 org.apache.flume.tools.GetJavaProperty Info: Including Hive libraries found via (/opt/hive-3.1.2) for Hive access + exec /opt/jdk1.8.0_351/bin/java -Xmx20m -cp '/opt/flume-1.9.0/lib/*:/opt/hadoop-3.1.2/etc/hadoop:/opt/hadoop-3.1.2/share/hadoop/common/lib/*:/opt/hadoop-3.1.2/share/hadoop/common/*:/opt/hadoop-3.1.2/share/hadoop/hdfs:/opt/hadoop-3.1.2/share/hadoop/hdfs/lib/*:/opt/hadoop-3.1.2/share/hadoop/hdfs/*:/opt/hadoop-3.1.2/share/hadoop/mapreduce/lib/*:/opt/hadoop-3.1.2/share/hadoop/mapreduce/*:/opt/hadoop-3.1.2/share/hadoop/yarn:/opt/hadoop-3.1.2/share/hadoop/yarn/lib/*:/opt/hadoop-3.1.2/share/hadoop/yarn/*:/opt/hbase-2.2.6/conf:/opt/jdk1.8.0_351//lib/tools.jar:/opt/hbase-2.2.6:/opt/hbase-2.2.6/lib/shaded-clients/hbase-shaded-client-byo-hadoop-2.2.6.jar:/opt/hbase-2.2.6/lib/client-facing-thirdparty/audience-annotations-0.5.0.jar:/opt/hbase-2.2.6/lib/client-facing-thirdparty/commons-logging-1.2.jar:/opt/hbase-2.2.6/lib/client-facing-thirdparty/findbugs-annotations-1.3.9-1.jar:/opt/hbase-2.2.6/lib/client-facing-thirdparty/htrace-core4-4.2.0-incubating.jar:/opt/hbase-2.2.6/lib/client-facing-thirdparty/log4j-1.2.17.jar:/opt/hbase-2.2.6/lib/client-facing-thirdparty/slf4j-api-1.7.25.jar:/opt/hadoop-3.1.2/etc/hadoop:/opt/hadoop-3.1.2/share/hadoop/common/lib/*:/opt/hadoop-3.1.2/share/hadoop/common/*:/opt/hadoop-3.1.2/share/hadoop/hdfs:/opt/hadoop-3.1.2/share/hadoop/hdfs/lib/*:/opt/hadoop-3.1.2/share/hadoop/hdfs/*:/opt/hadoop-3.1.2/share/hadoop/mapreduce/lib/*:/opt/hadoop-3.1.2/share/hadoop/mapreduce/*:/opt/hadoop-3.1.2/share/hadoop/yarn:/opt/hadoop-3.1.2/share/hadoop/yarn/lib/*:/opt/hadoop-3.1.2/share/hadoop/yarn/*:/opt/hadoop-3.1.2/etc/hadoop:/opt/hbase-2.2.6/conf:/opt/hive-3.1.2/lib/*' -Djava.library.path=:/opt/hadoop-3.1.2/lib/native org.apache.flume.node.Application --name a1 --conf/opt/flume-1.9.0/conf --conf-file/opt/flume-1.9.0/conf/dhfsspool.conf-Dflume.root.logger=DEBUG,consol SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/flume-1.9.0/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/hadoop-3.1.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 2023-06-08 17:26:46,403 ERROR node.Application: A fatal error occurred while running. Exception follows. org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: --conf/opt/flume-1.9.0/conf at org.apache.commons.cli.Parser.processOption(Parser.java:363) at org.apache.commons.cli.Parser.parse(Parser.java:199) at org.apache.commons.cli.Parser.parse(Parser.java:85) at org.apache.flume.node.Application.main(Application.java:287)

2023-06-09 上传