Storm-0.10.0集群安装(转载)

一、环境

两台虚拟机,ubuntu-14.04.3

二、关闭防火墙,配置hosts

 

[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  1. root@ubuntu:~# cat /etc/hosts  
  2. 127.0.0.1   localhost  
  3. 127.0.1.1   ubuntu  
  4.   
  5. 192.168.254.130 storm1  
  6. 192.168.254.131 storm2  

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

 

[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  1. root@ubuntu:~# cat /etc/profile  
  2. export JAVA_HOME=/usr/local/jdk1.7.0_80    
  3. export JRE_HOME=/$JAVA_HOME/jre  
  4. export PATH=$JAVA_HOME/bin:$PATH  
  5. export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar  

四、安装Python(2.6.6+)

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

 

[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  1. root@ubuntu:~# python -V  
  2. Python 2.7.6  

五、搭建ZooKeeper集群

 

[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  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
 
  在CODE上查看代码片 派生到我的代码片
  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
 
  在CODE上查看代码片 派生到我的代码片
  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
 
  在CODE上查看代码片 派生到我的代码片
  1. # 在dataDir目录下创建myid文件,写id号,用来标识当前主机  
  2. root@ubuntu:/opt/zookeeper/data# echo "1" > myid  

storm2节点重复上面操作,也可以直接复制,只是myid输入的值是2。

 

 

[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  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
 
  在CODE上查看代码片 派生到我的代码片
  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  
[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  1. # 省略...  
  2. ########### These MUST be filled in for a storm configuration  
  3.  storm.zookeeper.servers:  
  4.      - "storm1"  
  5.      - "storm2"  
  6. #   
  7.  nimbus.host: "storm1"  
  8.  storm.local.dir: "/opt/storm/data"  
  9.  supervisor.slots.port:  
  10.      - 6700  
  11.      - 6701  
  12.      - 6702  
  13.      - 6703  
  14.  nimbus.childopts: "-Xmx1024m"  
  15.  ui.childopts: "-Xmx768m"  
  16. #   
  17. # ##### These may optionally be filled in:  
  18. #      
  19. ## List of custom serializations  
  20. # topology.kryo.register:  
  21. #     - org.mycompany.MyType  
  22. #     - org.mycompany.MyType2: org.mycompany.MyType2Serializer  
  23. #  
  24. ## List of custom kryo decorators  
  25. # topology.kryo.decorators:  
  26. #     - org.mycompany.MyDecorator  
  27. #  
  28. ## Locations of the drpc servers  
  29. # drpc.servers:  
  30. #     - "server1"  
  31. #     - "server2"  
  32.   
  33. ## Metrics Consumers  
  34. # topology.metrics.consumer.register:  
  35. #   - class: "backtype.storm.metric.LoggingMetricsConsumer"  
  36. #     parallelism.hint: 1  
  37. #   - class: "org.mycompany.MyMetricsConsumer"  
  38. #     parallelism.hint: 1  
  39. #     argument:  
  40. #       - endpoint: "metrics-collector.mycompany.org"  
[plain]  view plain  copy
 
  在CODE上查看代码片 派生到我的代码片
  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
 
  在CODE上查看代码片 派生到我的代码片
  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
 
  在CODE上查看代码片 派生到我的代码片
  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  

 

七、遇到的问题

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

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

 

原文地址:http://blog.csdn.net/god_wot/article/details/50492179

猜你喜欢

转载自wb284551926.iteye.com/blog/2312333