- 监控文件中的内容递增的新信息
a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure the source a1.sources.r1.type = exec a1.sources.r1.command = tail -F /hadoop/hadoop/logs/yarn-root-nodemanager-hadoop2.log # 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
2.启动就可以看到
bin/flume-ng agent --name a1 --conf-file conf/exec.conf --conf conf/ -Dflume.root.logger=INFO,console -Dflume.monitoring.type=http -Dflume.monitoring.port=34343 &
3.在出现大批量的文件内容向channels中写入时候会出现内存溢出解决办法
修改exec.conf中的参数
# Use a channel which buffers events in memory a1.channels.c1.type = memory a1.channels.c1.capacity = 1000000 a1.channels.c1.transactionCapacity = 100000
4.修改flume-env.sh中的内存参数就可以了
# Give Flume more memory and pre-allocate, enable remote monitoring via JMX export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote"
时间: 2024-10-14 15:43:54