作者:sx-March23 | 2021-09-03 12:47
参考博客:《Storm0.9-single》(http://www.cnblogs.com/really-dt/p/3775663.html),感谢。0.安装依赖包[plain]viewplaincopyyuminstalluuid*&nbs
参考博客:《Storm0.9-single》(http://www.cnblogs.com/really-dt/p/3775663.html),感谢。
0.安装依赖包
-
yum install uuid*
-
yum install libtool
-
yum install libuuid
-
yum install libuuid-devel
不然安装过程会提示错误。
1.安装zeromq
从http://download.zeromq.org/下载最新的zeromq-4.0.4.tar.gz。
-
tar -zxvf zeromq-4.0.4.tar.gz
-
cd zeromq-4.0.4
-
./configure
-
make
-
make install
2.安装jzmq
-
git clone git://github.com/nathanmarz/jzmq.git
-
cd jzmq/
-
./autogen.sh
-
./configure
-
make
-
make install
3.安装zookeeper
从http://zookeeper.apache.org/releases.html下载最新的zookeeper-3.4.6.tar.gz.如果出现JAVA_HOME配置问题,需检查jdk的环境变量,比如我的是CentOS中的openjdk,没有在/etc/profile中配置,自己添加信息。
-
tar -zxvf zookeeper-3.4.6.tar.gz
-
sudo cp zookeeper-3.4.6 /usr/local/
-
vim ~/.bashrc
-
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.6
-
export PATH=$PATH:$ZOOKEEPER_HOME/bin
-
source ~/.bashrc
-
4.安装storm
从http://storm.incubator.apache.org/downloads.html下载最新的apache-storm-0.9.2-incubating.tar.gz.
-
tar -zxvf apache-storm-0.9.2-incubating.tar.gz
-
sudo cp apache-storm-0.9.2-incubating /usr/local/
-
vim ~/.bashrc
-
export STORM_HOME=/usr/local/apache-storm-0.9.2-incubating
-
export PATH=$PATH:$STORM_HOME/bin
-
source ~/.bashrc
再配置storm:
-
vim ./conf/storm.yaml (注意yaml格式的要求,空格tab,:和-前后都有空格)
文件中的内容修改为
-
storm.zookeeper.servers:
-
- "localhost"
-
storm.zookeeper.port : 2181
-
nimbus.host : "localhost"
-
storm.local.dir : "/usr/local/apache-storm-0.9.2-incubating/tmp"
-
supervisor.slots.ports:
-
- 6700
-
- 6701
-
- 6702
storm.local.dir 中的tmp文件夹不存在则自己创建。
5.测试用例
从github上获取storm-starter测试代码.
-
git clone https://github.com/nathanmarz/storm-starter.git
-
cd storm-starter/
-
mvn -f m2-pom.xml package(需要安装maven)
下面依次启动服务:
启动zookeeper(zookeeper/bin目录下)。启动时可能出现错误:zookeeper-3.4.6/bin/../conf/zoo.cfg 文件不存在,直接mv zoo_sample.cfg zoo.cfg即可。
启动storm
-
storm nimbus
-
storm supervisor
-
storm ui
提交Topology(storm-starter目录下)
[不带Topology名提交Topology,这中情况不会提交到nimbus去运行]
-
storm jar target/storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.WordCountTopology
[提交Topology]
-
storm jar ../storm-starter/target/storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.WordCountTopology myFirstStormApp
此时就可以通过Web界面查看了http://localhost:8080/
storm list 查看当前运行的Topology
可在storm目录下的logs下查看日志文件,包含nimbus.log
,supervisor
.log
,各个worker.log
.