全部課程
發(fā)布時(shí)間: 2019-09-18 17:06:15
③ Channel:angent 內(nèi)部的數(shù)據(jù)傳輸通道,用于從 source
flume 接收telnet網(wǎng)絡(luò)數(shù)據(jù)
vi netcat-logger.conf # 定義這個(gè)agent中各組件的名字 a1.sources = r1 a1.sinks = k1 a1.channels = c1 # 描述和配置source組件:r1 a1.sources.r1.type = netcat a1.sources.r1.bind = localhost a1.sources.r1.port = 44444 # 描述和配置sink組件:k1 a1.sinks.k1.type = logger # 描述和配置channel組件,此處使用是內(nèi)存緩存的方式 a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100 # 描述和配置source channel sink之間的連接關(guān)系 a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1 |
啟動(dòng)Flume
?[hd@Mas?ter flume]# flume-ng agent -c /home/hd/apps/flume/conf/ -f example/netcat-logger.conf -n a1 -Dflume.root.logger=INFO,console
?Flume采集日志文件到HDFS
# Name the components on this agent a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure the source #監(jiān)聽目錄,spoolDir指定目錄, fileHeader要不要給文件夾前墜名 a1.sources.r1.type = spooldir a1.sources.r1.spoolDir = /home/hadoop/flumespool a1.sources.r1.fileHeader = true # Describe the sink a1.sinks.k1.type = logger # Use a channel which buffers events in memory a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100 # Bind the source and sink to the channel a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1 |
啟動(dòng)Flume
?[hd@ma?ster flume]# flume-ng agent -c /home/hd/apps/flume/conf/ -f example/spool-logger.conf -n a1 -Dflume.root.logger=INFO,console