docker部署storm

docker run -d --restart always --name some-zookeeper zookeeper
docker run -d --restart always --name some-nimbus --link some-zookeeper:zookeeper storm storm nimbus
docker run -d --restart always --name supervisor --link some-zookeeper:zookeeper --link some-nimbus:nimbus storm storm supervisor
docker run -d -p 8887:8080 --restart always --name ui --link some-nimbus:nimbus storm storm ui

访问 http://192.168.2.214:8887

提交topology集群 官方写的

docker run --link some-nimbus:nimbus -it --rm -v $(pwd)/topology.jar:/topology.jar storm storm jar /topology.jar org.apache.storm.starter.WordCountTopology topology

试了官方的方式 报错 Error: Could not find or load main class com.liang.netcar.charging.StormStart

docker run --link some-nimbus:nimbus -it --rm -v liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar:/liang.jar storm storm jar /liang.jar com.liang.netcar.charging.StormStart cluster


docker run --link some-nimbus:nimbus -it --rm -v liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar:/liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm storm jar /liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar com.liang.netcar.charging.StormStart cluster

官方 本地模式运行

docker run -it -v $(pwd)/topology.jar:/topology.jar storm storm jar /topology.jar org.apache.storm.starter.ExclamationTopology

本地模式也报错

docker run -it -v liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar:/liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm storm jar /liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar com.liang.netcar.charging.StormStart cluster

进入容器里面运行 成功
docker cp liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar supervisor:/ 
docker exec -it supervisor /bin/bash
cd / 
storm jar liang-netcar-charging-0.0.1-SNAPSHOT-jar-with-dependencies.jar com.liang.netcar.charging.StormStart cluster

停止
storm kill NetcarChargingStormStart -w 3 

阿亮说技术
4 声望3 粉丝

程序人生,一路踩坑,一路填坑