1.因为storm依赖的组件很多,建议先安装好yum.
我使用的yum源是:
[company]
name=company
baseurl=http://yum.company.com/rhel_5.4_repo/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2. 修改host文件
#vi /etc/hosts/
127.0.0.1 localhost.localdomain localhost
172.16.3.7 nimbus
172.16.3.8 supervisor1
172.16.3.9 supervisor2
172.16.3.10 supervisor3
3.可以开始安装storm cluster了
step 1: 安装Python2.7.2
?# wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
?# tar zxvf Python-2.7.2.tgz
?# cd Python-2.7.2
?# ./configure
?# make
?# make install
?# vi /etc/ld.so.conf
追加/usr/local/lib/
?# sudo ldconfig
?# Python
查看版本是否正确
这样的话,Python2.7.2就安装完毕了。
step 2: 安装zookeeper
?# cd /home/company/platform
?# wget http://ftp.meisei-u.ac.jp/mirror/apache/dist//zookeeper/zookeeper-3.4.3/zookeeper-3.4.3.tar.gz
?# tar zxf zookeeper-3.4.3.tar.gz
?# cp -r /home/company/platform/zookeeper-3.4.3/ /home/company/platform/zookeeper
?# rm -r /home/company/platform/zookeeper-3.4.3/
?#sudo vi /etc/profile (设置ZOOKEEPER_HOME和ZOOKEEPER_HOME/bin)
追加:
export ZOOKEEPER_HOME=/home/company/platform/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin
?# cp /home/company/platform/zookeeper/conf/zoo_sample.cfg /home/company/platform/zookeeper/conf/zoo.cfg (用zoo_sample.cfg制作$ZOOKEEPER_HOME/conf/zoo.cfg)
?# vi /home/company/platform/zookeeper/conf/zoo.cfg
这里是配置zookeeper最关键的一步,也就是修改zoo.cfg配置文件,每台电脑都要配一样的。我的配置内容为:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/home/company/platform/zookeeper/data
dataLogDir=/home/company/platform/zookeeper/log
# the port at which the clients will connect
clientPort=2181
server.0=nimbus:2888:3888
server.1=supervisor1:2888:3888
server.2=supervisor2:2888:3888
server.3=supervisor3:2888:3888
?# echo 0 > /home/company/platform/zookeeper/data/myid
这一步是每台电脑上都不同的。也就是说cluster的echo是0,supervisor1的echo是1,supervisor2的echo是2,supervisor3的echo是3。
?# bin/zkSever.sh start
这步是启动三台机器上的zookeeper,每台机器都要做。
接下去有几个命令是查看集群中zookeeper状态的:su -
?# bin/zkSever.sh status
?# echo stat | nc ip 2181
?# echo conf | nc ip 2181
?# echo dump | nc ip 2181
?# echo wchs | nc ip 2181
?# echo ruok | nc ip 2181
?# bin/zkCli.sh.stat /
?# bin/zkCli.sh ls /
然后创建zookeeper临时文件。
?# mkdir /home/company/platform/zookeeper/data
?# mkdir /home/company/platform/zookeeper/log好的,zookeeper的集群安装已经完成了。
step 3:安装zeromq (每台都安装)
?# wget http://download.zeromq.org/zeromq-2.2.0.tar.gz
?# tar zxf zeromq-2.2.0.tar.gz
?# cd zeromq-2.1.7
?# ./configure
?# make
?# make install
?# sudo ldconfig (更新LD_LIBRARY_PATH)
这里要说一下在./configure中可能会遇到的问题:
首先我遇到了:configure:error:in '/usr/local/download/zeromq-2.1.7':
congifure:error:no acceptable C compiler found in $PATH
See 'config.log' for more details
这是因为没有安装C编译器。
解决方法是:# yum install gcc*
之后遇到的问题是:Error:cannot link with -luuid, install uuid-dev
这是因为没有安装uuid相关的package。
解决方法是:# yum install uuid*
# yum install e2fsprogs*
# yum install libuuid*
问题解决了以后就可以make和make install了,如此这般,zeromq就安装好了。
step 4:安装jzmq (每台都安装)
?# https://github.com/nathanmarz/jzmq 下载
?# cd jzmq
?# ./autogen.sh
?# ./configure
?# make
?# make install
在./autogen.sh这步如果报错:autogen.sh:error:could not find libtool is required to run autogen.sh,这是因为缺少了libtool,可以用#yum install libtool*来解决。
然后,jzmq就装好了。
step 5: 安装storm (每台都安装)
?# cd /home/company/platform
?# wget http://github.com/downloads/nathanmarz/storm-0.8.0.zip
?# unzip storm-0.8.0.zip
?# cp -r storm-0.8.0 /home/company/platform/strom
?vi /etc/profile
追加export STORM_HOME=/home/company/platform/strom
export PATH=$PATH:$STORM_HOME/bin
# vi conf/storm.yaml
我的配置内容是这样的:
storm.zookeeper.servers:
- "nimbus"
- "supervisor1"
- "supervisor2"
- "supervisor3"
storm.zookeeper.port: 2181
storm.local.dir: "/home/company/platform/storm/data"
java.library.path: /usr/local/lib:/opt/local/lib:/usr/lib
nimbus.host: "nimbus"
supervisor.slots.ports:
- 6700
- 6701
- 6702
-6703
# mkdir /home/company/platform/storm/data
说明一下:storm.local.dir表示storm需要用到的本地目录。
nimbus.host表示那一台机器是master机器,即nimbus。
storm.zookeeper.servers表示哪几台机器是zookeeper服务器。
storm.zookeeper.port表示 zookeeper的端口号,这里一定要与zookeeper配置的端口号一致,否则会出现通信错误,切记切记。当然你也可以配 superevisor.slot.port,supervisor.slots.ports表示supervisor节点的槽数,就是最多能跑几个 worker进程(每个sprout或bolt默认只启动一个worker,但是可以通过conf修改成多个)。
好的,到这里,我们的storm集群就配置好了。
启动storm集群
# bin/storm nimbus(主节点)
# bin/storm supervisor(从节点)
# bin/storm ui来启动UI查看,然后我们就可以在http://{NimbusHost}:8080进行查看。
安装kestrel [172.16.3.7]
直接使用编译好的jar文件。
# wget http://robey.github.com/kestrel/download/kestrel-2.2.0.zip
# unzip kestrel-2.2.0.zip
# mv kestrel-2.2.0 /usr/local/kestrel
# mkdir /usr/local/kestrel/current
# cp /usr/local/kestrel/*.jar /usr/local/kestrel/current
运行
java -jar /usr/local/kestrel/kestrel_2.9.1-2.2.0.jar &
利用kestrelclient方法put message到queue中的说明
https://github.com/nathanmarz/storm/wiki/Kestrel-and-Storm