天天看點

Storm安裝

安裝storm需要安裝下面一些依賴元件:

1. 推薦版本

  ZeroMQ2.1.7 Java6  Python2.6.6

2. python和jdk安裝

  jdk安裝完成後需要設定下JAVA_HOME。

vi /etc/profile
export JAVA_HOME=/opt/soft/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/rt.jar
source /etc/profile      

3. zookeeper安裝

  在 http://zookeeper.apache.org/releases.html 上選擇合适版本下載下傳,直接解壓zookeeper包到指定目錄即可。啟動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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/data/zookeeper
dataLogDir=/data/zookeeper
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=zookeeper-node1:2888:3888
server.2=zookeeper-node2:2888:3888
server.3=zookeeper-node3:2888:3888      

 zookeeper-node1的映射在/etc/hosts中添加,完成zoo.cfg的修改後,還需要在dataDir下生成一加個myid檔案,并在檔案中輸入中對應的編号。例如:

在server.1的機器上輸入myid檔案的内容為:  

echo 1 >> /data/zookeeper/myid      

 現在可以一次啟動各個服務其上的zookeeper節點了,啟動指令:    

bin/zkServer.sh start      

 zookeeper的日志輸出在zookeeper.out檔案中,節點的運作狀态可以通過下面指令查詢:

bin/zkServer.sh status      

4.zeromq 安裝

通過下面指令完成zeromq的安裝

wget http://download.zeromq.org/zeromq-2.1.7.tar.gz
tar -xzf zeromq-2.1.7.tar.gz
cd zeromq-2.1.7
./configure
make
sudo make install      

安裝過程中可能會出現一些依賴包找不到的情況:

如果報錯
configure: error: in `/usr/local/download/zeromq-2.1.7':
 configure: error: no acceptable C compiler found in $PATH
 See `config.log' for more details
原因為沒有安裝c compiler
解決方法
# yum install gcc*
如果遇到Error:cannot link with -luuid, install uuid-dev
原因為缺少uuid相關package
解決方法
# yum install uuid*
# yum install e2fsprogs*
# yum install libuuid*      

5.jzmq 安裝

通過下面指令完成jzmq安裝

git clone https://github.com/nathanmarz/jzmq.git
cd jzmq./autogen.sh
./configure
make
sudo make install      

這些依賴元件安裝完成後就可以開始storm之旅了。

從https://github.com/nathanmarz/storm/downloads下載下傳合适的storm版本,解壓到指定目錄即可。

啟動前需要配置下conf/storm.yml檔案。

nimbus節點主要需要修改的地方:

storm.zookeeper.servers:
    - "server-hd01.bj"
    - "server-hd02.bj"
    - "server-hd04.bj"
storm.local.dir: "/home/data/storm"      

worker節點主要需要修改的地方

storm.zookeeper.servers:
    - "server-hd01.bj"
    - "server-hd02.bj"
    - "server-hd04.bj"
storm.local.dir: "/home/data/storm"
nimbus.host: "server-dn02.bj"      

更加詳細的配置可以參照https://github.com/nathanmarz/storm/wiki/Setting-up-a-Storm-cluster,修改完配置後就可以依次啟動相應的節點了。

通過下面指令啟動nimbus節點

bin/storm nimbus      

在nimbus節點還可以啟動ui界面

bin/storm ui      

啟動完成後可以通過http://{nimbus host}:8080進行通路

bin/storm supervisor