Storm-0.10.0集群安装

一、环境

两台虚拟机,ubuntu-14.04.3

二、关闭防火墙,配置hosts

root@ubuntu:~# cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	ubuntu

192.168.254.130 storm1
192.168.254.131 storm2

三、安装Java(JDK 6+),并配置环境变量

root@ubuntu:~# cat /etc/profile
export JAVA_HOME=/usr/local/jdk1.7.0_80  
export JRE_HOME=/$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

四、安装Python(2.6.6+)

确定系统自带的Python版本,如果是2.6.6+可以不用再安装。

root@ubuntu:~# python -V
Python 2.7.6
五、搭建ZooKeeper集群

root@ubuntu:/usr/local# wget http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.7/zookeeper-3.4.7.tar.gz
root@ubuntu:/usr/local# tar -zxvf zookeeper-3.4.7.tar.gz
root@ubuntu:/usr/local# cd zookeeper-3.4.7/conf
root@ubuntu:/usr/local/zookeeper-3.4.7/conf# cp -p zoo_sample.cfg zoo.cfg
root@ubuntu:/usr/local/zookeeper-3.4.7/conf# vim 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=/opt/zookeeper/data
# the port at which the clients will connect
clientPort=2181
server.1=storm1:7000:7001
server.2=storm2:7000:7001
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# 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
# 手动创建dataDir目录
root@ubuntu:/opt# mkdir zookeeper
root@ubuntu:/opt# cd zookeeper
root@ubuntu:/opt/zookeeper# mkdir data

# 在dataDir目录下创建myid文件,写id号,用来标识当前主机
root@ubuntu:/opt/zookeeper/data# echo "1" > myid
storm2节点重复上面操作,也可以直接复制,只是myid输入的值是2。

# 启动ZooKeeper
root@storm1:/usr/local/zookeeper-3.4.7# bin/zkServer.sh start
root@storm2:/usr/local/zookeeper-3.4.7# bin/zkServer.sh start

# 查看ZooKeeper状态
root@storm1:/usr/local/zookeeper-3.4.7# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.7/bin/../conf/zoo.cfg
Mode: follower
root@storm1:/usr/local/zookeeper-3.4.7# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.7/bin/../conf/zoo.cfg
Mode: leader
六、安装Storm

# 下载安装Storm
root@ubuntu:/usr/local# wget wget http://mirrors.cnnic.cn/apache/storm/apache-storm-0.10.0/apache-storm-0.10.0.tar.gz
root@ubuntu:/usr/local# tar -zxvf apache-storm-0.10.0.tar.gz
root@ubuntu:/usr/local# mv apache-storm-0.10.0 storm-0.10.0
# 省略...
########### These MUST be filled in for a storm configuration
 storm.zookeeper.servers:
     - "storm1"
     - "storm2"
# 
 nimbus.host: "storm1"
 storm.local.dir: "/opt/storm/data"
 supervisor.slots.port:
     - 6700
     - 6701
     - 6702
     - 6703
 nimbus.childopts: "-Xmx1024m"
 ui.childopts: "-Xmx768m"
# 
# ##### These may optionally be filled in:
#    
## List of custom serializations
# topology.kryo.register:
#     - org.mycompany.MyType
#     - org.mycompany.MyType2: org.mycompany.MyType2Serializer
#
## List of custom kryo decorators
# topology.kryo.decorators:
#     - org.mycompany.MyDecorator
#
## Locations of the drpc servers
# drpc.servers:
#     - "server1"
#     - "server2"

## Metrics Consumers
# topology.metrics.consumer.register:
#   - class: "backtype.storm.metric.LoggingMetricsConsumer"
#     parallelism.hint: 1
#   - class: "org.mycompany.MyMetricsConsumer"
#     parallelism.hint: 1
#     argument:
#       - endpoint: "metrics-collector.mycompany.org"
# 创建storm.local.dir目录
root@ubuntu:/opt# mkdir storm
root@ubuntu:/opt/storm# mkdir data
root@ubuntu:/opt/storm/data# pwd
/opt/storm/data
storm2节点重复上面操作,共同部分可以直接复制。

# 启动Storm(确保ZooKeeper已正常启动)
root@storm1:/usr/local/storm-0.10.0# bin/storm nimbus >/dev/null 2>&1 &
root@storm2:/usr/local/storm-0.10.0# bin/storm supervisor >/dev/null 2>&1 &
root@storm1:/usr/local/storm-0.10.0# bin/storm ui >/dev/null 2>&1 &
# 查看启动进程
root@storm1:~# jps
2658 QuorumPeerMain
2696 nimbus
2813 core
3334 Jps

root@ubuntu:~# jps
2673 supervisor
3287 Jps
2632 QuorumPeerMain

七、遇到的问题

如果出现IPv6引起的连接问题可以修改Storm启动JVM参数,如下:

 nimbus.childopts: "-Xmx1024m -Djava.net.preferIPv4Stack=true"
 ui.childopts: "-Xmx768m -Djava.net.preferIPv4Stack=true"


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值