flume执行原理 是什么
三大可新组件
1.源端采集了理数据给他传输了管道中,管道加载的数据传输到下沉端,在传输到
2.
安装flume
压缩包
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
# 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
————————————————————————————————————————
使用在hadoop下创建 vi /var/log.txt
输入hello word
tail -F /var/log.txt
克隆一个页面 echo 1 >>/var/log.txt
![](https://i-blog.csdnimg.cn/blog_migrate/869e9c9ccd2befef6e58f464eb1e51c2.jpeg)
![](https://i-blog.csdnimg.cn/blog_migrate/5c267e5fb05fec49a30edad643636ced.png)
——-------------------------------------------------------------------------------------------------
vi tail.sh
#!/bin/bath
for i in {1..1000}
do
echo "hello $i" >> /var/log.txt
sleep 2
done
启动 sh tail.sh
![](https://i-blog.csdnimg.cn/blog_migrate/d39424557b2696afecb0fce87eff39ab.jpeg)
![](https://i-blog.csdnimg.cn/blog_migrate/b6e250a58d5a55ecc0e05c2da9fcf738.jpeg)
改为下面
![](https://i-blog.csdnimg.cn/blog_migrate/1c87624696f15f11c359aa32131044c1.jpeg)
继续
![](https://i-blog.csdnimg.cn/blog_migrate/c15014d957530d96cd1613bc74f91c67.jpeg)
改为
![](https://i-blog.csdnimg.cn/blog_migrate/c581a3299dcb4088ae509b7007fa1883.jpeg)
配置完成
flume动态使用
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
# 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
测试脚本不正确
vi flume.sh
![](https://i-blog.csdnimg.cn/blog_migrate/6deb132925314247c46ee51040608a60.jpeg)
上面输出了10000遍
sh flume.sh