Storm-0.10.0集群安装

来源:互联网 发布:鸟哥的linux 编辑:程序博客网 时间:2024/06/06 07:01


1. 下载地址:

http://storm.apache.org/releases.html

2. 依赖环境

Zookeeper,Python,Java(JDK 6+)

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


搭建ZooKeeper集群

[plain] view plain copy
  1. root@ubuntu:/usr/local# wget http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.7/zookeeper-3.4.7.tar.gz  
[plain] view plain copy
  1. root@ubuntu:/usr/local# tar -zxvf zookeeper-3.4.7.tar.gz  
  2. root@ubuntu:/usr/local# cd zookeeper-3.4.7/conf  
  3. root@ubuntu:/usr/local/zookeeper-3.4.7/conf# cp -p zoo_sample.cfg zoo.cfg  
  4. root@ubuntu:/usr/local/zookeeper-3.4.7/conf# vim zoo.cfg  
  5. # The number of milliseconds of each tick  
  6. tickTime=2000  
  7. # The number of ticks that the initial   
  8. # synchronization phase can take  
  9. initLimit=10  
  10. # The number of ticks that can pass between   
  11. # sending a request and getting an acknowledgement  
  12. syncLimit=5  
  13. # the directory where the snapshot is stored.  
  14. # do not use /tmp for storage, /tmp here is just   
  15. # example sakes.  
  16. dataDir=/opt/zookeeper/data  
  17. # the port at which the clients will connect  
  18. clientPort=2181  
  19. server.1=storm1:7000:7001  
  20. server.2=storm2:7000:7001  
  21. # the maximum number of client connections.  
  22. # increase this if you need to handle more clients  
  23. #maxClientCnxns=60  
  24. #  
  25. # Be sure to read the maintenance section of the   
  26. # administrator guide before turning on autopurge.  
  27. #  
  28. # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance  
  29. #  
  30. # The number of snapshots to retain in dataDir  
  31. #autopurge.snapRetainCount=3  
  32. # Purge task interval in hours  
  33. # Set to "0" to disable auto purge feature  
  34. #autopurge.purgeInterval=1  
[plain] view plain copy
  1. # 手动创建dataDir目录  
  2. root@ubuntu:/opt# mkdir zookeeper  
  3. root@ubuntu:/opt# cd zookeeper  
  4. root@ubuntu:/opt/zookeeper# mkdir data  

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

[plain] view plain copy
  1. # 启动ZooKeeper  
  2. root@storm1:/usr/local/zookeeper-3.4.7# bin/zkServer.sh start  
  3. root@storm2:/usr/local/zookeeper-3.4.7# bin/zkServer.sh start  
  4.   
  5. # 查看ZooKeeper状态  
  6. root@storm1:/usr/local/zookeeper-3.4.7# bin/zkServer.sh status  
  7. ZooKeeper JMX enabled by default  
  8. Using config: /usr/local/zookeeper-3.4.7/bin/../conf/zoo.cfg  
  9. Mode: follower  
  10. root@storm1:/usr/local/zookeeper-3.4.7# bin/zkServer.sh status  
  11. ZooKeeper JMX enabled by default  
  12. Using config: /usr/local/zookeeper-3.4.7/bin/../conf/zoo.cfg  
  13. Mode: leader  
六、安装Storm

[plain] view plain copy
  1. # 下载安装Storm  
  2. root@ubuntu:/usr/local# wget wget http://mirrors.cnnic.cn/apache/storm/apache-storm-0.10.0/apache-storm-0.10.0.tar.gz  
  3. root@ubuntu:/usr/local# tar -zxvf apache-storm-0.10.0.tar.gz  
  4. root@ubuntu:/usr/local# mv apache-storm-0.10.0 storm-0.10.0  
  5. root@ubuntu:/usr/local# vimstorm-0.10.0/conf/storm.yaml
[plain] view plain copy
  1. # 省略...  
  2. ########### These MUST be filled in for a storm configuration  
  3. #配置zookeeper内的所有节点
  4.  storm.zookeeper.servers:  
  5.      - "storm1"  
  6.      - "storm2"  
  7.    
  8. #配置nimbus所在节点,在集群内选一个作为nimbus,BUT有单点问题。
  9.  nimbus.host: "storm1" 

  10. #storm的工作目录,据说上传的JAR包什么的,在里面 
  11.  storm.local.dir: "/opt/storm/data"  

  12. #supervisor节点上,每个端口对应一个slot,
  13.  supervisor.slots.port:  
  14.      - 6700  
  15.      - 6701  
  16.      - 6702  
  17.      - 6703  
  18.  nimbus.childopts: "-Xmx1024m"  
  19.  ui.childopts: "-Xmx768m"  

  20. #UI的端口号,老实改掉,8080太容易冲突了
  21. ui.port:58080

  22. #   
  23. # ##### These may optionally be filled in:  
  24. #      
  25. ## List of custom serializations  
  26. # topology.kryo.register:  
  27. #     - org.mycompany.MyType  
  28. #     - org.mycompany.MyType2: org.mycompany.MyType2Serializer  
  29. #  
  30. ## List of custom kryo decorators  
  31. # topology.kryo.decorators:  
  32. #     - org.mycompany.MyDecorator  
  33. #  
  34. ## Locations of the drpc servers  
  35. #drpc服务起的节点和端口号
  36.  drpc.servers:  
  37.      - "server1"  
  38.      - "server2"  
  39. #端口可以不用配置
  40. #  drpc.port:1234
  41. ## Metrics Consumers  
  42. # topology.metrics.consumer.register:  
  43. #   - class: "backtype.storm.metric.LoggingMetricsConsumer"  
  44. #     parallelism.hint: 1  
  45. #   - class: "org.mycompany.MyMetricsConsumer"  
  46. #     parallelism.hint: 1  
  47. #     argument:  
  48. #       - endpoint: "metrics-collector.mycompany.org"  
[plain] view plain copy
  1. # 创建storm.local.dir目录  
  2. root@ubuntu:/opt# mkdir storm  
  3. root@ubuntu:/opt/storm# mkdir data  
  4. root@ubuntu:/opt/storm/data# pwd  
  5. /opt/storm/data  
storm2节点重复上面操作,共同部分可以直接复制。

[plain] view plain copy
  1. # 启动Storm(确保ZooKeeper已正常启动)  
  2. root@storm1:/usr/local/storm-0.10.0# bin/storm nimbus >/dev/null 2>&1 &  
  3. root@storm2:/usr/local/storm-0.10.0# bin/storm supervisor >/dev/null 2>&1 &  
  4. root@storm1:/usr/local/storm-0.10.0# bin/storm ui >/dev/null 2>&1 &  
[plain] view plain copy
  1. # 查看启动进程  
  2. root@storm1:~# jps  
  3. 2658 QuorumPeerMain  
  4. 2696 nimbus  
  5. 2813 core  
  6. 3334 Jps  
  7.   
  8. root@ubuntu:~# jps  
  9. 2673 supervisor  
  10. 3287 Jps  
  11. 2632 QuorumPeerMain  

nimbus: nohup ./bin/storm nimbus &
supervisor:nohup ./bin/storm supervisor&
ui: nohup ./bin/storm ui &
drpc: nohup ./bin/storm drpc &
# 所有节点打开logviewer
nohup ./bin/storm logviewer &


七、遇到的问题

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

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

问题排查: 
1:如果发现无法在webui界面查看日志信息 
只可能是两个问题 
一:可能是logviewer进程没启动 
二:主机名和ip的映射关系没有配置 
2:服务器的8080端口被占用导致ui进程启动失败 
修改storm.yaml文件 
ui.port: 8081 
最完整的属性配置在storm-core.jar中的defaults.yaml文件中