sz上傳壓縮包到目錄下(linux下解壓tar文件)
tar -zxvf xmms.tar.gz解壓縮文件
Linux下自帶了一個(gè)unzip的程序可以解壓縮文件,(linux下解壓zip文件)
解壓命令是:unzip filename.zip
同樣也提供了一個(gè)zip程序壓縮zip文件,命令是
zip filename.zip files
會(huì)將files壓縮到filename.zip
解壓縮完畢后,修改flume-env.sh配置文件,主要是修改java_home變量配置
1.root@m1:/home/hadoop/flume-1.5.0-bin# cpconf/flume-env.sh.template conf/flume-env.sh
2.root@m1:/home/hadoop/flume-1.5.0-bin# viconf/flume-env.sh
3.# Licensed to the Apache SoftwareFoundation (ASF) under one
4.# or more contributor licenseagreements.??See the NOTICE file
5.# distributed with this work foradditional information
6.# regarding copyrightownership.??The ASF licenses this file
7.# to you under the Apache License,Version 2.0 (the
8.# "License"); you may not usethis file except in compliance
9.# with the License.??You mayobtain a copy of the License at
10.#
11.#????http://www.apache.org/licenses/LICENSE-2.0
12.#
13.# Unless required by applicable law oragreed to in writing, software
14.# distributed under the License isdistributed on an "AS IS" BASIS,
15.# WITHOUT WARRANTIES OR CONDITIONS OFANY KIND, either express or implied.
16.# See the License for the specificlanguage governing permissions and
17.# limitations under the License.
18.
19.# If this file is placed atFLUME_CONF_DIR/flume-env.sh, it will be sourced
20.# during Flume startup.
21.
22.# Enviroment variables can be set here.
23.
24.JAVA_HOME=/usr/lib/jvm/java-7-oracle
25.
26.# Give Flume more memory andpre-allocate, enable remote monitoring via JMX
27.#JAVA_OPTS="-Xms100m -Xmx200m-Dcom.sun.management.jmxremote"
28.
29.# Note that the Flume conf directory isalways included in the classpath.
30.#FLUME_CLASSPATH=""
3)驗(yàn)證是否安裝成功
1.root@m1:/home/hadoop#/home/hadoop/flume-1.5.0-bin/bin/flume-ng version
2.Flume 1.5.0
3.Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
4.Revision:8633220df808c4cd0c13d1cf0320454a94f1ea97
5.Compiled by hshreedharan on WedMay??7 14:49:18 PDT 2014
6.From source with checksuma01fe726e4380ba0c9f7a7d222db961f
7.root@m1:/home/hadoop#
cd /opt/hadoop/
ls
./apache-flume-1.6.0-bin/bin/flume-ngversion
cd /opt/hadoop/
ls
./apache-flume-1.6.0-bin/bin/flume-ngversion

出現(xiàn)以上信息,表示安裝成功
一、什么是Flume?
flume作為cloudera開(kāi)發(fā)的實(shí)時(shí)日志收集系統(tǒng),受到了業(yè)界的認(rèn)可與廣泛應(yīng)用。Flume初始的發(fā)行版本目前被統(tǒng)稱(chēng)為Flume OG(original generation),屬于cloudera。但隨著FLume功能的擴(kuò)展,F(xiàn)lume OG代碼工程臃腫、核心組件設(shè)計(jì)不合理、核心配置不標(biāo)準(zhǔn)等缺點(diǎn)暴露出來(lái),尤其是在Flume OG的最后一個(gè)發(fā)行版本0.94.0中,日志傳輸不穩(wěn)定的現(xiàn)象尤為嚴(yán)重,為了解決這些問(wèn)題,2011年10月22號(hào),cloudera完成了Flume-728,對(duì)Flume進(jìn)行了里程碑式的改動(dòng):重構(gòu)核心組件、核心配置以及代碼架構(gòu),重構(gòu)后的版本統(tǒng)稱(chēng)為Flume NG(next generation);改動(dòng)的另一原因是將Flume納入apache旗下,cloudera Flume改名為Apache Flume。
flume的特點(diǎn):
flume是一個(gè)分布式、可靠、和高可用的海量日志采集、聚合和傳輸?shù)南到y(tǒng)。支持在日志系統(tǒng)中定制各類(lèi)數(shù)據(jù)發(fā)送方,用于收集數(shù)據(jù);同時(shí),F(xiàn)lume提供對(duì)數(shù)據(jù)進(jìn)行簡(jiǎn)單處理,并寫(xiě)到各種數(shù)據(jù)接受方(比如文本、HDFS、Hbase等)的能力。
flume的數(shù)據(jù)流由事件(Event)貫穿始終。事件是Flume的基本數(shù)據(jù)單位,它攜帶日志數(shù)據(jù)(字節(jié)數(shù)組形式)并且攜帶有頭信息,這些Event由Agent外部的Source生成,當(dāng)Source捕獲事件后會(huì)進(jìn)行特定的格式化,然后Source會(huì)把事件推入(單個(gè)或多個(gè))Channel中。你可以把Channel看作是一個(gè)緩沖區(qū),它將保存事件直到Sink處理完該事件。Sink負(fù)責(zé)持久化日志或者把事件推向另一個(gè)Source。
flume的可靠性
當(dāng)節(jié)點(diǎn)出現(xiàn)故障時(shí),日志能夠被傳送到其他節(jié)點(diǎn)上而不會(huì)丟失。Flume提供了三種級(jí)別的可靠性保障,從強(qiáng)到弱依次分別為:end-to-end(收到數(shù)據(jù)agent首先將event寫(xiě)到磁盤(pán)上,當(dāng)數(shù)據(jù)傳送成功后,再刪除;如果數(shù)據(jù)發(fā)送失敗,可以重新發(fā)送。),Store on failure(這也是scribe采用的策略,當(dāng)數(shù)據(jù)接收方crash時(shí),將數(shù)據(jù)寫(xiě)到本地,待恢復(fù)后,繼續(xù)發(fā)送),Besteffort(數(shù)據(jù)發(fā)送到接收方后,不會(huì)進(jìn)行確認(rèn))。
flume的可恢復(fù)性:
還是靠Channel。推薦使用FileChannel,事件持久化在本地文件系統(tǒng)里(性能較差)。
flume的一些核心概念:
1.Agent使用JVM運(yùn)行Flume。每臺(tái)機(jī)器運(yùn)行一個(gè)agent,但是可以在一個(gè)agent中包含多個(gè)sources和sinks。
2.Client生產(chǎn)數(shù)據(jù),運(yùn)行在一個(gè)獨(dú)立的線(xiàn)程。
3.Source從Client收集數(shù)據(jù),傳遞給Channel。
4.Sink從Channel收集數(shù)據(jù),運(yùn)行在一個(gè)獨(dú)立線(xiàn)程。
5.Channel連接sources和sinks,這個(gè)有點(diǎn)像一個(gè)隊(duì)列。
6.Events可以是日志記錄、avro對(duì)象等。
Flume以agent為最小的獨(dú)立運(yùn)行單位。一個(gè)agent就是一個(gè)JVM。單agent由Source、Sink和Channel三大組件構(gòu)成,如下圖:

值得注意的是,F(xiàn)lume提供了大量?jī)?nèi)置的Source、Channel和Sink類(lèi)型。不同類(lèi)型的Source,Channel和Sink可以自由組合。組合方式基于用戶(hù)設(shè)置的配置文件,非常靈活。比如:Channel可以把事件暫存在內(nèi)存里,也可以持久化到本地硬盤(pán)上。Sink可以把日志寫(xiě)入HDFS, HBase,甚至是另外一個(gè)Source等等。Flume支持用戶(hù)建立多級(jí)流,也就是說(shuō),多個(gè)agent可以協(xié)同工作,并且支持Fan-in、Fan-out、Contextual Routing、Backup Routes,這也正是NB之處。如下圖所示:

清空vim編輯器里面的所有內(nèi)容
[root@dev-masterapache-flume-1.6.0-bin]# cd conf/
[root@dev-masterconf]# ll

[root@dev-masterconf]# cat /dev/null > avro.properties
[root@dev-masterconf]# ll

啟動(dòng)flume

[root@dev-master~]# cd /opt
[root@dev-masteropt]# ls
apache-tomcat-6.0.32-demodrillhadoopjavaweblogmesossoftspark-1.4zookeepers
datafunnytestjavakafkaeslost+foundscalasparkspark-with-hive
[root@dev-masteropt]# cd hadoop/
[root@dev-masterhadoop]# ls
apache-flume-1.6.0-binapache-flume-1.6.0-bin.tar.gzcurr_hadoophadoop-2.7.1

Permision denied問(wèn)題解決方案