環境要求JDK 1.6+java -versionPython 2.6.6+python -V ZooKeeper3.4.5+storm 0.9.4+ 單機模式上傳解壓 下麵分別啟動ZooKeeper、Nimbus、UI、supervisor、logviewer 需要多等一會兒,通過jps觀察 登錄 ...
環境要求
JDK 1.6+
java -version
Python 2.6.6+
python -V
ZooKeeper3.4.5+
storm 0.9.4+
單機模式
上傳解壓
$ tar xf apache-storm-0.9.4.tar.gz $ cd apache-storm-0.9.4 $ mkdir logs $ bin/storm --help
下麵分別啟動ZooKeeper、Nimbus、UI、supervisor、logviewer
$ ./bin/storm dev-zookeeper >> ./logs/zk.out 2>&1 & $ ./bin/storm nimbus >> ./logs/nimbus.out 2>&1 & $ ./bin/storm ui >> ./logs/ui.out 2>&1 & $ ./bin/storm supervisor >> ./logs/supervisor.out 2>&1 & $ ./bin/storm logviewer &
需要多等一會兒,通過jps觀察
$ jps 6966 Jps 6684 logviewer 6680 dev_zookeeper 6681 nimbus 6682 core 6683 supervisor
登錄ui
http://node1:8080/
運行測試程式
$ bin/storm jar examples/storm-starter/storm-starter-topologies-0.9.4.jar storm.starter.WordCountTopology wordcount $ bin/storm jar examples/storm-starter/storm-starter-topologies-0.9.4.jar storm.starter.WordCountTopology test
完全分散式
3個節點部署ZooKeeper集群 node1為nimbus
3台機器分別安裝解壓storm安裝包,修改配置文件
$ vim conf/storm.yaml
storm.zookeeper.servers: - "node1" - "node2" - "node3" storm.local.dir: "/tmp/storm" nimbus.host: "node1" supervisor.slots.ports: - 6700 - 6701 - 6702 - 6703
在storm目錄中創建logs目錄
$ mkdir logs
啟動ZooKeeper集群
node1上啟動Nimbus
$ ./bin/storm nimbus >> ./logs/nimbus.out 2>&1 & $ tail -f logs/nimbus.log $ ./bin/storm ui >> ./logs/ui.out 2>&1 & $ tail -f logs/ui.log
節點node2和node3啟動supervisor,按照配置,每啟動一個supervisor就有了4個slots
$ ./bin/storm supervisor >> ./logs/supervisor.out 2>&1 & $ tail -f logs/supervisor.log
登錄ui
http://node1:8080/
運行測試程式
$ bin/storm jar examples/storm-starter/storm-starter-topologies-0.9.4.jar storm.starter.WordCountTopology test
環境變數配置
export STORM_HOME=/usr/storm
export PATH=$PATH:$STORM_HOME/bin
觀察關閉一個supervisor後,nimbus的重新調度
再次啟動一個新的supervisor後,觀察,並rebalance