集群环境
主机操作系统:Centos-7.3-x64
zookeeper环境(已搭建好):
zk1: 192.168.103.15
zk2: 192.168.103.5
zk3: 192.168.103.3
主机列表:
nimbus: 192.168.103.16
storm1: 192.168.103.10
storm2:192.168.103.7
storm3: 192.168.103.21
jdk环境:jdk1.8
安装步骤
1.下载并解压storm安装包
下载storm安装包(1.0.6),并解压到/opt目录下。
# wget http://apache.forsale.plus/storm/apache-storm-1.0.6/apache-storm-1.0.6.tar.gz
# tar xf apache-storm-1.0.6.tar.gz -C /opt/
修改nimbus, storm1, storm2, storm3主机/etc/hosts文件
192.168.103.16 nimbus
192.168.103.10 storm1
192.168.103.7 storm2
192.168.103.21 storm3
2.修改配置
storm.zookeeper.port: 30000
storm.zookeeper.servers:
- "192.168.103.15"
- "192.168.103.5"
- "192.168.103.3"
storm.local.dir: "/opt/apache-storm-1.0.6/status"
nimbus.seeds: ["nimbus"]
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
配置文件描述
storm.zookeeper.servers
- zookeeper集群地址
storm.zookeeper.port
- 如果zookeeper服务端口不是默认端口,需要在此指定
storm.local.dir
- The Nimbus and Supervisor daemons require a directory on the local disk to store small amounts of state
- Nimbus和Supervisor 守护进程存储状态的路径
nimbus.seeds
The worker nodes need to know which machines are the candidate of master in order to download topology jars and confs
主控节点,可以配置多个
supervisor.slots.ports
For each worker machine, you configure how many workers run on that machine with this config. Each worker uses a single port for receiving messages, and this setting defines which ports are open for use. If you define five ports here, then Storm will allocate up to five workers to run on this machine. If you define three ports, Storm will only run up to three. By default, this setting is configured to run 4 workers on the ports 6700, 6701, 6702, and 6703.
worker进程用于接收消息的端口
3. 复制到集群
storm1,storm2, storm3执行如下指令
# cd /opt
# scp -r root@nimbus:/opt/apache-storm-1.0.6 .
4.启动集群
nimbus 节点
/opt/apache-storm-1.0.6/bin/storm nimbus 1>/dev/null 2>&1 &
/opt/apache-storm-1.0.6/bin/storm ui 1>/dev/null 2>&1 &
storm1, storm2, storm3节点
/opt/apache-storm-1.0.6/bin/storm supervisor 1>/dev/null 2>&1 &
访问storm集群的ui界面
http://192.168.103.16:8080
当出现以上页面时,说明集群搭建正确。