- 这里的storm集群,由3台服务器构成
- 依赖JDK环境+zookeeper集群
- 配置jdk环境变量
source /etc/profile
刷新环境变量 - 检查集群时间
date
yum install -y ntp
- 同步时间命令 ntpdate
ntpdate ntp6.aliyun.com
#关闭防火墙
service iptables stop
注: 永久关闭防火墙[推荐使用]
chkconfig iptables off
映射 cat /etc/hosts
IP地址 主机名
- zookeeper集群搭建
- 解压zookeeper安装包
tar -zxvf zookeeper-3.4.7.tar.gz -C /export/servers/
修改配置文件
cd /export/servers/zookeeper/conf
mv zoo_sample.cfg zoo.cfg
vi zoo.cfg
# 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=/export/data/zkdata
# 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=node1:2888:3888
server.2=node2:2888:3888
server.3=node3:2888:3888
//#修改路径.改成自己的data文件夹路径
// #(心跳端口、选举端口)
- 3台机器都要操作,创建zk的数据目录和日志目录。
cd /export/data
mkdir zkdata
#3台机器都要操作,在data文件夹下新建myid文件,myid的文件内容为(设置节点的id):
cd zkdata
第一台上:echo 1 > myid
第二台上:echo 2 > myid
第三台上:echo 3 > myid
- 在数据目录下创建zk节点的编号
- 分发修改后的安装文件
scp -r /export/server/zookeeper root@node2:/export/server
scp -r /export/server/zookeeper root@node3:/export/server
- ##启动(每台机器)
zkServer.sh start
- storm是依赖于zookeeper的,搭建storm集群前,必须先把zookeeper集群搭建好
- 上传解压storm安装包到指定目录
- tar -zxvf apache-storm-1.1.1.tar.gz -C …/services/
- 修改配置文件 storm.yaml,修改内容如下:
storm.zookeeper.servers:
- "node01"
- "node02"
- "node03"
#
nimbus.seeds: ["node01", "node02", "node03"]
storm.local.dir: "/export/data/stormdata"
ui.port: 8088
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
- 将安装包分发到其他机器
scp -r apache-storm-1.1.1/ node02:/export/services/
scp -r apache-storm-1.1.1/ node03:/export/services/
- 启动storm相关服务
启动 nimbus进程(主节点)
nohup bin/storm nimbus >/dev/null 2>&1 &
启动supervisor(从节点)
nohup bin/storm supervisor >/dev/null 2>&1 &
启动web UI(主节点)
nohup bin/storm ui >/dev/null 2>&1 &
启动logViewer
nohup bin/storm logviewer >/dev/null 2>&1 &
`
- 查看集群
访问nimbus.host:/8088,即可看到storm的ui界面。