内容简介:本文将主要介绍flume安装。flume版本:apache-flume-1.9.0可以根据自己的需要到官网下载自己需要的版本:
目录
本文将主要介绍flume安装。
实验环境
flume版本:apache-flume-1.9.0
可以根据自己的需要到官网下载自己需要的版本: http://flume.apache.org/
安装flume
将flume安装到Master目录/usr/local/下
解压
sudo tar apache-flume-1.9.0-bin.tar.gz -C /usr/local/
重命名文件
sudo mv apache-flume-1.9.0-bin flume
修改文件权限
sudo chown -R hadoop:hadoop flume
配置环境变量
sudo vim ~/.bashrc
export FLUME_HOME=/usr/local/flume export FLUME_CONF_DIR=$FULME_HOME/conf export PATH=$PATH:$FLUME_HOME/bin
环境变量生效
source ~/.bashrc
配置文件
cd flume/conf cp flume-conf.properties.template flume-conf.properties sudo vim flume-conf.properties
agent1表示代理名称
agent1.sources=source1 agent1.sinks=sink1 agent1.channels=channel1
配置source1
agent1.sources.source1.type=spooldir agent1.sources.source1.spoolDir=/usr/local/logs agent1.sources.source1.channels=channel1 agent1.sources.source1.fileHeader = false agent1.sources.source1.interceptors = i1 agent1.sources.source1.interceptors.i1.type = timestamp
配置channel1
gent1.channels.channel1.type=file agent1.channels.channel1.checkpointDir=/usr/local/logs_tmp_cp agent1.channels.channel1.dataDirs=/usr/local/logs_tmp
配置sink1
agent1.sinks.sink1.type=hdfs agent1.sinks.sink1.hdfs.path=hdfs://sparkproject1:9000/logs agent1.sinks.sink1.hdfs.fileType=DataStream agent1.sinks.sink1.hdfs.writeFormat=TEXT agent1.sinks.sink1.hdfs.rollInterval=1 agent1.sinks.sink1.channel=channel1 agent1.sinks.sink1.hdfs.filePrefix=%Y-%m-%d
配置后的完整文件
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # The configuration file needs to define the sources, # the channels and the sinks. # Sources, channels and sinks are defined per agent, # in this case called 'agent' agent1.sources=source1 agent1.sinks=sink1 agent1.channels=channel1 # For each one of the sources, the type is defined agent1.sources.source1.type=spooldir agent1.sources.source1.spoolDir=/usr/local/logs agent1.sources.source1.channels=channel1 agent1.sources.source1.fileHeader = false agent1.sources.source1.interceptors = i1 agent1.sources.source1.interceptors.i1.type = timestamp # Each sink's type must be defined agent1.sinks.sink1.type=hdfs agent1.sinks.sink1.hdfs.path=hdfs://Master:9000/logs agent1.sinks.sink1.hdfs.fileType=DataStream agent1.sinks.sink1.hdfs.writeFormat=TEXT agent1.sinks.sink1.hdfs.rollInterval=1 agent1.sinks.sink1.channel=channel1 agent1.sinks.sink1.hdfs.filePrefix=%Y-%m-%d # Each channel's type is defined. agent1.channels.channel1.type=file agent1.channels.channel1.checkpointDir=/usr/local/logs_tmp_cp agent1.channels.channel1.dataDirs=/usr/local/logs_tmp # Other config values specific to each type of channel(sink or source) # can be defined as well # In this case, it specifies the capacity of the memory channel agent.channels.memoryChannel.capacity = 100
创建需要的文件夹
在/usr/local/目录下创建logs文件夹
cd /usr/local/ sudo mkdir logs
创建hdfs文件夹
hdfs dfs -mkdir /logs
查看文件夹
hdfs dfs -ls /
启动flume-agent
flume-ng agent -n agent1 -c conf -f /usr/local/flume/conf/flume-conf.properties -Dflume.root.logger=DEBUG,console
至此,flume已经安装完成,下一篇将介绍spark的安装步骤。
以上所述就是小编给大家介绍的《7.Spark大型电商项目-大数据环境搭建之flume安装》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- webpack入门(2) - 安装,配置,环境搭建
- 快速安装与配置kubernetes集群搭建
- Linux 下 Go 环境搭建以及 Gin 安装
- 使用 docker-compose 安装搭建 RabbitMQ 集群
- [译] 一万元搭建深度学习系统:硬件、软件安装教程以及性能测试
- Flutter 安装搭建报错 Android sdkmanager tool not found
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。