7.Spark大型电商项目-大数据环境搭建之flume安装

栏目: 服务器 · 发布时间: 5年前

内容简介:本文将主要介绍flume安装。flume版本:apache-flume-1.9.0可以根据自己的需要到官网下载自己需要的版本:

目录

本文将主要介绍flume安装。

实验环境

flume版本:apache-flume-1.9.0

可以根据自己的需要到官网下载自己需要的版本: http://flume.apache.org/

7.Spark大型电商项目-大数据环境搭建之flume安装

安装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安装》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

微商思维

微商思维

龚文祥、罗剑锋、触电会 / 金城出版社 / 2018-7 / 88.00元

微商不仅仅是一种继传统实体、电商之后的革命性新兴商业形态,更是一种能够写入中国商业史的思潮。龚文祥新著《微商思维》,从道的层面对广大微商人的商业实践智慧进行了高度浓缩与抽象总结,站在更高的视角解读微商背后的商业逻辑与本质。 本书前半部分,主要从本质、品牌、营销等几个方面,阐述了微商思维的内涵及应用场景,帮助读者了解并认识这种革命性的商业思维。 后半部分主要是触电会社群内部各位大咖的实操......一起来看看 《微商思维》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具