欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

storm集群搭建  

程序员文章站 2022-03-20 18:27:44
...

   前面已经搭好了zookeeper集群,下面开始搭建storm集群。

 

   1.机器准备 还是那三台

    172.17.0.2/172.17.0.3/172.17.0.4

 

    2.下载storm

     wget http://mirror.bjtu.edu.cn/apache/storm/apache-storm-1.0.1/apache-storm-1.0.1.tar.gz

 

    3.解压

     tar xvf xx.xx.tar.gz

 

     4.修改storm配置

      vi conf/storm.yaml   有些是手工加进去的配置

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

########### These MUST be filled in for a storm configuration
storm.zookeeper.servers:
    - "172.17.0.2"
    - "172.17.0.3"
    - "172.17.0.4"
# port如果是2181可以不写这个配置
storm.zookeeper.port: 2181 

##########
# storm.local.dir: The Nimbus and Supervisor daemons require a directory on the local disk to 
# store small amounts of state (like jars, confs, and things like that). You should create that 
# directory on each machine, give it proper permissions, and then fill in the directory location using this config.
storm.local.dir: "/root/storm"

########## nimbus的ip
nimbus.seeds: ["172.17.0.2"]


########## supervisor机器的worker的端口号
# 写四个端口 表示这个机器最多可以启动四个worker ,,,三个端口则最多三个worker
supervisor.slots.ports:
    - 6700
    - 6701
    - 6702
    - 6703
# 
# 
# ##### 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: "org.apache.storm.metric.LoggingMetricsConsumer"
#     parallelism.hint: 1
#   - class: "org.mycompany.MyMetricsConsumer"
#     parallelism.hint: 1
#     argument:
#       - endpoint: "metrics-collector.mycompany.org"

    

    5.启动

     172.17.0.2 

  bin/storm nimbus &

     172.17.0.3

      bin/storm supervisor &

      172.17.0.4 

      bin/storm supervisor &

  可以启动ui方便浏览器查看:

  172.17.0.2上面执行

  bin/storm ui &

 

  6.通过浏览器访问

  http://172.17.0.2:8080

 

  7.测试word count

  bin/storm jar example/storm-starter/storm-starter-topologies-1.0.1.jar org.apache.storm.starter.WordCountTopology wc

 

  8.观察日志

  tail -f logs/workers-artifacts/wc-1-1464159627/6702/worker.log

 

  9.kill一个任务

  bin/storm kill wc