第一周的主要工作是熟悉storm和JStorm,首先当然得尝试安装来感受一下,以下是storm安装记录:
(参考:http://li.angshan.blog.163.com/blog/static/1313322892013433956796/
http://my.oschina.net/mingdongcheng/blog/43009 )
第一步,安装zookeeper
- # wget http://ftp.meisei-u.ac.jp/mirror/apache/dist//zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gz
- # tar zxf zookeeper-3.3.3.tar.gz
- # cp -R zookeeper-3.3.3 /usr/local/
- # ln -s /usr/local/zookeeper-3.3.3/ /usr/local/zookeeper
- # vim /etc/profile (设置ZOOKEEPER_HOME和ZOOKEEPER_HOME/bin)
追加:
export ZOOKEEPER_HOME="/path/to/zookeeper"
export PATH=$PATH;$ZOOKEEPER_HOME/bin
- # cp /usr/local/zookeeper/conf/zoo_sample.cfg /usr/local/zookeeper/conf/zoo.cfg (用zoo_sample.cfg制作$ZOOKEEPER_HOME/conf/zoo.cfg)
- # sudo mkdir /tmp/zookeeper
- # sudo mkdir /var/log/zookeeper
好的,zookeeper的单机安装已经完成了。
第三步,安装zeromq以及jzmq
jzmq的安装貌似是依赖zeromq的,所以应该先装zeromq,再装jzmq。
1)安装zeromq:
- # wget http://download.zeromq.org/historic/zeromq-2.1.7.tar.gz
- # tar zxf zeromq-2.1.7.tar.gz
- # cd zeromq-2.1.7
- # ./configure
- # make
- # make install
- # sudo ldconfig (更新LD_LIBRARY_PATH)
接下来我们安装jzmq。
2)安装jzmq
- # git clone git://github.com/nathanmarz/jzmq.git
- # cd jzmq
- # ./autogen.sh
- # ./configure
- # make
- # make install
但是在make时出错了,经检查后修改步骤如下,然后就成功了:)
- # touch src/classdist_noinst.stamp
- # cd src/org/zeromq/
- # javac *.java
- # make
- # sudo make install
第五步,安装Storm
- # wget http://www.apache.org/dyn/closer.cgi/incubator/storm/apache-storm-0.9.2-incubating/apache-storm-0.9.2-incubating.zip
- # tar -xzf apache-storm-0.9.2-incubating.zip
- # cp -R storm-* /usr/local/storm
- # sudo vim /etc/environment
追加export STORM_HOME=/usr/local/storm-0.7.1
export PATH=$PATH;$STORM_HOME/bin
到此为止单机版的Storm就安装完毕了。
第六步,测试一下本地模式的WordCount
Github里有一个例子叫做storm_starter,我们可以用它来做测试。
执行命令:# storm jar examples/storm-starter/storm-starter-topologies-0.9.2-incubating.jar storm.starter.WordCountTopology
如果出现下面的文字,说明运行成功了~
....
11367 [Thread-25] INFO backtype.storm.daemon.task - Emitting: class storm.starter.ExclamationTopology$ExclamationBolt source: 2:3, stream: 1, id: {}, [golda!!!]
....