使用cloudera的源来进行安装flume,使用的系统为CentOS 6.0,64位的系统。
1. 安装cloudear的源
a. 下载
wget http://archive.cloudera.com/redhat/6/x86_64/cdh/cdh3-repository-1.0-1.noarch.rpm -P /usr/local/src
b. 安装
yum localinstall --nogpgcheck /usr/local/src/cdh3-repository-1.0-1.noarch.rpm
c. 导入RPM-GPG-KEY
rpm --import http://archive.cloudera.com/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera
d. 安装flume
yum install flume flume-master flume-node
会自动安装相关的依赖包,如果只作为node,可以只安装flume和flume-node而不安装flume-master
2. 创建配置
cloudera的软件包都使用alternatives来配置配置文件。
a. 复制配置文件
cp -r /etc/flume/conf.empty /etc/flume/conf.my_cluster
可以叫你想叫任何名字
b. 查看配置文件
alternatives --display flume-conf
c. 安装新的自定义配置
alternatives --install /etc/flume/conf flume-conf /etc/flume/conf.my_cluster 50
d. 确认安装
alternatives --display flume-conf
flume-conf - status is auto.
link currently points to /etc/flume/conf.my_cluster
/etc/flume/conf.empty - priority 30
/etc/flume/conf.my_cluster - priority 50
Current `best' version is /etc/flume/conf.my_cluster.
配置文件目录/etc/flume/conf/会自动链接到我们制定的目录中/etc/flume/conf.my_cluster。
3. 修改配置文件
a. 所有节点设置master(多个master时)
- vi /etc/flume/conf/flume-site.xml
- <property>
- <name>flume.master.servers</name>
- <value>master01,master02,...</value>
- <description>This is the address for the config servers status
- server (http)
- </description>
- </property>
- <property>
- <name>flume.master.serverid</name>
- <value>id</value>
- <description>The unique identifier for a machine in a
- Flume Master ensemble. Must be different on every
- master instance.</description>
- </property>
flume.master.servers:用逗号分隔多个master地址列表
flume.master.serverid:master的唯一标识
b. 启动master节点
server flume-master start
chkconfig flume-master on
c. 在a步骤中设置了各个node节点的master后,可以启动node节点
service flume-node start
4. 检验flume
启动flume shell
flume shell
[flume (disconnected)] connect host
如果有修改过adminport或者reportport,可以使用
connect host[:adminport=35873[:reportport=45678]]
获得各个子节点的状态
flume test01.linuxjcq.com:35873:45678] getnodestatus
flume的所有节点的配置都可以通过flume shell完成,默认使用内存存储各个节点的配置信息,可以使用ZooKeeper保存所有节点的配置信息。