Storm-0.10.0集群安装

    xiaoxiao2021-12-14  19

    一、环境

    两台虚拟机,ubuntu-14.04.3

    二、关闭防火墙,配置hosts

    [plain] view plain copy 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+),并配置环境变量

    [plain] view plain copy 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+可以不用再安装。

    [plain] view plain copy root@ubuntu:~# python -V  Python 2.7.6   五、搭建ZooKeeper集群 [plain] view plain copy 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 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   [plain] view plain copy # 手动创建dataDir目录  root@ubuntu:/opt# mkdir zookeeper  root@ubuntu:/opt# cd zookeeper  root@ubuntu:/opt/zookeeper# mkdir data   [plain] view plain copy # 在dataDir目录下创建myid文件,写id号,用来标识当前主机  root@ubuntu:/opt/zookeeper/data# echo "1" > myid   storm2节点重复上面操作,也可以直接复制,只是myid输入的值是2。 [plain] view plain copy # 启动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 [plain] view plain copy # 下载安装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   [plain] view plain copy # 省略...  ########### 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"   [plain] view plain copy # 创建storm.local.dir目录  root@ubuntu:/opt# mkdir storm  root@ubuntu:/opt/storm# mkdir data  root@ubuntu:/opt/storm/data# pwd  /opt/storm/data   storm2节点重复上面操作,共同部分可以直接复制。 [plain] view plain copy # 启动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 &   [plain] view plain copy # 查看启动进程  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"

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

    Storm的安装步骤

    1、正常安装JDK,测试JKD是否安装正常。

    $ java -version

    2、正常安装Python,测试Python是否安装正常。

    $ python

    3、正常安装Zookeeper。

    $ cd apache/

    $ tar -xvf zookeeper-3.4.5.tar.gz

    $ cd zookeeper-3.4.5/

    $ mkdir data

    $ mkdir logs

    $ cd conf/

    $ cp zoo_sample.cfg zoo.cfg

    $ vim zoo.cfg

    tickTime=2000

    initLimit=10

    syncLimit=5

    dataDir=/home/wcbdd/apache/zookeeper-3.4.5/data

    dataLogDir=/home/wcbdd/apache/zookeeper-3.4.5/logs

    clientPort=2181

    server.1=localhost:2888:3888

    $ cd ..

    $ echo "1" > data/myid

    $ cd ~

    $ vim .bashrc

    exportZOOKEEPER_HOME=/home/wcbdd/apache/zookeeper-3.4.5

    exportPATH=$PATH:$ZOOKEEPER_ HOME/bin

    $ su – wcbdd

    $ cd apache/zookeeper-3.4.5/bin/

    $ vim zkEnv.sh

    if ["x${ZOO_LOG_DIR}" = "x" ]

    then

       ZOO_LOG_DIR="$ZOOKEEPER_HOME/logs"

    fi

    if ["x${ZOO_LOG4J_PROP}" = "x" ]

    then

        ZOO_LOG4J_PROP="INFO,ROLLINGFILE"

    fi

    4、启动Zookeeper,并检查其工作状态。

    $ zkServer.sh start

    $ jps

    $ zkServer.sh status

    备注:标红的是刚才开启的Zookeeper进程,HQuorumPeer是Hbase内置的Zookeeper进程,因为以前配置的Hbase是由内置Zookeeper托管的,其实工作环境中一般都是把Hbase交给外部Zookeeper集群来托管。

    5、安装Storm。

    $ cd apache/

    $ tar -xvf apache-storm-0.9.6.tar.gz

    $ cd apache-storm-0.9.6/

    $ mkdir data

    $ vim conf/storm.yaml

    storm.zookeeper.servers:

        - "localhost"

     storm.zookeeper.port: 2181

     nimbus.host: "localhost"

     storm.local.dir:"/home/wcbdd/apache/apache-storm-0.9.6/data"

     supervisor.slots.ports:

        - 6700

        - 6701

        - 6702

        - 6703

    备注:设置了从节点slots有4个端口,即最多一个节点能开启4个worder,每个worker是一个进程,一个进程又可开启很多个线程task。这个值可根据节点资源配置情况和业务需求进行设置。

    $ cd ~

    $ vim .bashrc

    exportSTORM_HOME=/home/wcbdd/apache/apache-storm-0.9.6

    exportPATH=$PATH:$STORM_HOME/bin

    $ su - wcbdd

    6、启动Storm。

    $ storm nimbus >/dev/null 2>&1 &          //启动主节点

    $ storm supervisor >/dev/null 2>&1&    //启动从节点

    $ storm ui >/dev/null 2>&1 &                    //启动后台UI管理界面

    7、查看Storm是否正常启动。

    $ jps

    备注:上图的nimbus为storm主节点进程,supervisor为从节点进程,core为后台管理界面进程。

    8、通过浏览器查看Storm后台管理界面。

    备注:第一个红框显示了storm的版本号、主节点运行时间、从节点数量、slots使用情况、任务数量等;第二个红框显示当前没有拓扑任务;第三个红框显示从节点信息,由图可知,这个storm集群只有一个从节点,运行在wcbdd主机上,有4个slots,当前使用的slots数量为0。

    9、执行Storm的示例程序WordCountTopology。

    $ cd apache/apache-storm-0.9.6/examples/ storm-starter/

    $ storm jar storm-starter-topologies-0.9.6.jarstorm.starter.WordCountTopology wordcount

    备注:此命令的作用是用storm将这个jar包发送给storm去执行,后面的wordcount是定义的topology名称。

    10、停止拓扑任务wordcount。

    $ storm deactivate wordcount

    Kafka-Storm 集成部署 http://www.linuxidc.com/Linux/2016-03/129063.htm

    Storm在Ubuntu环境下的单机部署 http://www.linuxidc.com/Linux/2016-03/129060.htm

    本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-08/134184.htm

    原文地址:http://www.linuxidc.com/Linux/2016-08/134184.htm

    转载请注明原文地址: https://ju.6miu.com/read-969383.html

    最新回复(0)