Centos7.4 Storm2.0.0 + Zookeeper3.5.5は、高可用性クラスタを構築します

私は次の嵐やカフカクラスタとクラスタが個別に優れていると思います

  1. クラスター計画:

円光 監督
storm01
storm02 √(バックアップ)
storm03
  1. 準備

    • 3台の仮想マシンの古い道をコピーし、ネットワーク構成、ホスト名とホストファイルを変更、ファイアウォールをオフにします

      1571493131411

      • vimの/ etc / sysconfig / network-scriptsに/のifcfg-ens33ネットワーク構成を変更します
      # storm01
      TYPE=Ethernet
      PROXY_METHOD=none
      BROWSER_ONLY=no
      BOOTPROTO=static
      DEFROUTE=yes
      IPV4_FAILURE_FATAL=no
      IPV6INIT=yes
      IPV6_AUTOCONF=yes
      IPV6_DEFROUTE=yes
      IPV6_FAILURE_FATAL=no
      IPV6_ADDR_GEN_MODE=stable-privacy
      NAME=ens33
      DEVICE=ens33
      ONBOOT=yes
      IPADDR=192.168.180.170 # 你的虚拟网卡VMNet8, 如果是桥接的改成桥接网卡VMNet1
      PREFIX=24
      GATEWAY=192.168.180.2
      DNS1=114.114.114.114
      IPV6_PRIVACY=no
      # storm02
      TYPE=Ethernet
      PROXY_METHOD=none
      BROWSER_ONLY=no
      BOOTPROTO=static
      DEFROUTE=yes
      IPV4_FAILURE_FATAL=no
      IPV6INIT=yes
      IPV6_AUTOCONF=yes
      IPV6_DEFROUTE=yes
      IPV6_FAILURE_FATAL=no
      IPV6_ADDR_GEN_MODE=stable-privacy
      NAME=ens33
      DEVICE=ens33
      ONBOOT=yes
      IPADDR=192.168.180.171 # 你的虚拟网卡VMNet8, 如果是桥接的改成桥接网卡VMNet1
      PREFIX=24
      GATEWAY=192.168.180.2
      DNS1=114.114.114.114
      IPV6_PRIVACY=no
      # storm03
      TYPE=Ethernet
      PROXY_METHOD=none
      BROWSER_ONLY=no
      BOOTPROTO=static
      DEFROUTE=yes
      IPV4_FAILURE_FATAL=no
      IPV6INIT=yes
      IPV6_AUTOCONF=yes
      IPV6_DEFROUTE=yes
      IPV6_FAILURE_FATAL=no
      IPV6_ADDR_GEN_MODE=stable-privacy
      NAME=ens33
      DEVICE=ens33
      ONBOOT=yes
      IPADDR=192.168.180.172 # 你的虚拟网卡VMNet8, 如果是桥接的改成桥接网卡VMNet1
      PREFIX=24
      GATEWAY=192.168.180.2
      DNS1=114.114.114.114
      IPV6_PRIVACY=no
      • VIMの/ etc / hostnameは、ホスト名が変更されているstorm01、storm02、storm03

      • vimの/ etc / hostsファイルには、ホストを変更するファイル

        127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
        192.168.180.170 storm01
        192.168.180.171 storm02
        192.168.180.172 storm03
      • ファイアウォールをオフにします。サービスが停止しfirewalld

    • 無料秘密ログインします。ssh-keygenはRSAの公開鍵と秘密鍵を生成します

    ssh-keygen
    # 然后enter, enter, enter 直到生成RSA, 默认会在当前用户的家目录下生成.ssh
    
    [root@storm01 ~]# ls -ah
    .   anaconda-ks.cfg  .bash_logout   .bashrc  .config  .dbus                 .pki  .tcshrc   .xauthEJoei0
    ..  .bash_history    .bash_profile  .cache   .cshrc   initial-setup-ks.cfg  .ssh  .viminfo  .Xauthority
    • 隠し.sshディレクトリには、id_rsaと(秘密鍵)とid_rsa.pub(公開鍵)を持っています

    • CDの〜/ .sshはauthorized_keysにを作成し、公開鍵3台の仮想マシンは、その中に格納されます。

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdS1NsbxsccW/6YMkUKZ4BUNYXnFw9Iapwl/xM/THaILWi3VyAVIOY1cT1BgfS01NxpcUI/aqBIwZvWgKEdJe8XL4fJgAHgkJklbP5LRd1eI6CprLTn0RJNaZuRDX2GqPkmsz+1pRZo6TBuzx1q1sPrUEeH6GYR/oQWm8JTLFs8ppXeu0prsNAehl1MvT0xEpegdc7CVGTHyZUuOV8/nxBHux0motRJpy0UpQCY/abazhy+CQ/TS8/VQu3mAsdK/5KIHwyR92NPnUP7w89f1BsEgywFMgOhbLmsqfaDXVvCB38AfzQOKqdXL2CExyKTAEDwU6+AIX6Clm/UCrn1hPN root@storm01
    
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZ05EemLXkNiWXuM6WSHWhs9uGI5PVacNgI7KctAK1UgOZwcBOu2UZqk1nTvboIz0yYfFKBjvY2Ea4eBh5VzOqqJh7JmHm+58px34h+qmpdYvlnnmi2Bhu9vr9DO9EeqlmKxVDc9kqfjTWbLpLsrg+0K9KGVZwOXXvRtVRT2k88NbMegGRwsG03/H8uaBpOOUYyAe3vNqqgpg/5rnt824ZUWUaHKHGyQegIxejFrC5nhhejTPQ5PIDdxWIckhnvRASUXMEsoj7k7CKRD9HA4+o5XuzTyJ/tVYIheyK8k82LOoHKocXsbb5wJ7sLBuDaS2y63ZOc2AjoEtttkxvgjUB root@storm02
    
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN3QLZWNzQRp/4G0vTIGWtD2vS11B7g0rGyaBYobR/JYMddJV7jeuu7lbb3wWxpJo/AdwrLJNBRG9uFmFBpHdbX6JUz5anz+tb4hWVUAzDN1oNt+ZL7F0SCeQGx1EBHCYeAT12S0U8wfOpeS8/92m4Bm2ngKxbPKO9r6cAfzI2xngJKQ1jEbejzOulE9BiIvdAkFza8e3voqb1QQaLUHfUbW/VGXe+f/LAzpeAk7oFMwvealnyckpwYbxFaTjMrKwyvx3Gpe0iXoFeiYdBJOQZmmpntQRrymyvWg9iqG69ynQlCaA6OU6PV324hzy77vxL+c3yQFn3IVXf7rNTnspR root@storm03
    • 無料秘密のテストログイン:

      [root@storm01 ~]# ssh [email protected]
      Last login: Sat Oct 19 22:35:56 2019 from storm01
      [root@storm02 ~]# 

      PS:最初はknown_hostsファイルを生成します、秘密鍵を保存するの.sshディレクトリの下にファイルを保存するように求められます、内部が知らホストSHA(安全ハッシュコードAlgorithum)情報

  2. JDKのインストール

    • このマシンは、JDK、JDKのインストールと設定を参照してくださいインストールされています:

    • https://www.cnblogs.com/ronnieyuan/p/11622315.html

  3. 飼育係のインストール

    • このマシンは、飼育係、飼育係のインストールと設定を参照してくださいにインストールされています:
    • https://www.cnblogs.com/ronnieyuan/p/11622315.html
    • 違いは、クラスタ名です
  4. 嵐のインストール

    • タールパッケージをアップロード

      1571497714068

    • 指定したディレクトリにタールパッケージを抽出し、名前を変更します

      tar -zxvf apache-storm-2.0.0.tar.gz -C /opt/ronnie/
      
      mv apache-storm-2.0.0/ storm-2.0.0
    • 設定ファイルを変更します。

      vim /opt/ronnie/storm-2.0.0/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
    # 指定Zookeeper服务器
    storm.zookeeper.servers:
         - "storm01"
         - "storm02"
         - "storm03"
    # 指定storm集群中的nimbus节点所在的服务器 
    nimbus.seeds: ["storm01", "storm02", "storm03"]
    
    # 指定文件存放目录
    storm.local.dir: "/var/storm"
    # 
    # 指定supervisor节点上, 启动worker时对应的端口号, 每个端口对应槽, 每个槽对应一个worker
    supervisor.slots.ports:
        - 6700
        - 6701
        - 6702
        - 6703
    # 指定web ui 的端口为9099
    ui.port: 9099
    # 
    # ##### 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
    ## max.retain.metric.tuples
    ## - task queue will be unbounded when max.retain.metric.tuples is equal or less than 0.
    ## whitelist / blacklist
    ## - when none of configuration for metric filter are specified, it'll be treated as 'pass all'.
    ## - you need to specify either whitelist or blacklist, or none of them. You can't specify both of them.
    ## - you can specify multiple whitelist / blacklist with regular expression
    ## expandMapType: expand metric with map type as value to multiple metrics
    ## - set to true when you would like to apply filter to expanded metrics
    ## - default value is false which is backward compatible value
    ## metricNameSeparator: separator between origin metric name and key of entry from map
    ## - only effective when expandMapType is set to true
    ## - default value is "."
    # topology.metrics.consumer.register:
    #   - class: "org.apache.storm.metric.LoggingMetricsConsumer"
    #     max.retain.metric.tuples: 100
    #     parallelism.hint: 1
    #   - class: "org.mycompany.MyMetricsConsumer"
    #     max.retain.metric.tuples: 100
    #     whitelist:
    #       - "execute.*"
    #       - "^__complete-latency$"
    #     parallelism.hint: 1
    #     argument:
    #       - endpoint: "metrics-collector.mycompany.org"
    #     expandMapType: true
    #     metricNameSeparator: "."
    
    ## Cluster Metrics Consumers
    # storm.cluster.metrics.consumer.register:
    #   - class: "org.apache.storm.metric.LoggingClusterMetricsConsumer"
    #   - class: "org.mycompany.MyMetricsConsumer"
    #     argument:
    #       - endpoint: "metrics-collector.mycompany.org"
    #
    # storm.cluster.metrics.consumer.publish.interval.secs: 60
    
    # Event Logger
    # topology.event.logger.register:
    #   - class: "org.apache.storm.metric.FileBasedEventLogger"
    #   - class: "org.mycompany.MyEventLogger"
    #     arguments:
    #       endpoint: "event-logger.mycompany.org"
    
    # Metrics v2 configuration (optional)
    #storm.metrics.reporters:
    #  # Graphite Reporter
    #  - class: "org.apache.storm.metrics2.reporters.GraphiteStormReporter"
    #    daemons:
    #        - "supervisor"
    #        - "nimbus"
    #        - "worker"
    #    report.period: 60
    #    report.period.units: "SECONDS"
    #    graphite.host: "localhost"
    #    graphite.port: 2003
    #
    #  # Console Reporter
    #  - class: "org.apache.storm.metrics2.reporters.ConsoleStormReporter"
    #    daemons:
    #        - "worker"
    #    report.period: 10
    #    report.period.units: "SECONDS"
    #    filter:
    #        class: "org.apache.storm.metrics2.filters.RegexFilter"
    #        expression: ".*my_component.*emitted.*"
    
    • 嵐は、別の仮想マシンへの再帰的なディレクトリを送りました

      scp -r /opt/ronnie/storm-2.0.0/ [email protected]:/opt/ronnie/
      scp -r /opt/ronnie/storm-2.0.0/ [email protected]:/opt/ronnie/
    • 嵐を開始および停止するシェルスクリプトを作成します。

      • binディレクトリにcd /opt/ronnie/storm-2.0.0/bin/

      • Vimのstart-storm-all.sh

        #!/bin/bash
        #nimbus节点
        nimbusServers='storm01 storm02'
        
        #supervisor节点
        supervisorServers='storm01 storm02 storm03'
        
        #启动所有的nimbus
        for nim in $nimbusServers
        do
            ssh -T $nim <<EOF
                nohup /opt/ronnie/storm-2.0.0/bin/storm nimbus >/dev/null 2>&1 &
        EOF
        echo 从节点 $nim 启动nimbus...[ done ]
        sleep 1
        done
        
        #启动所有的ui
        for u in $nimbusServers
        do
            ssh -T $u <<EOF
                nohup /opt/ronnie/storm-2.0.0/bin/storm ui >/dev/null 2>&1 &
        EOF
        echo 从节点 $u 启动ui...[ done ]
        sleep 1
        done
        
        #启动所有的supervisor
        for visor in $supervisorServers
        do
            ssh -T $visor <<EOF
                nohup /opt/ronnie/storm-2.0.0/bin/storm supervisor >/dev/null 2>&1 &
        EOF
        echo 从节点 $visor 启动supervisor...[ done ]
        sleep 1
        done
        
        ~
        
      • Vimのstop-storm-all.sh

      !/bin/bash
      
      #nimbus节点
      nimbusServers='storm01 storm02'
      
      #supervisor节点
      supervisorServers='storm01 storm02 storm03'
      
      #停止所有的nimbus和ui
      for nim in $nimbusServers
      do
          echo 从节点 $nim 停止nimbus和ui...[ done ]
          ssh $nim "kill -9 `ssh $nim ps -ef | grep nimbus | awk '{print $2}'| head -n 1`" >/dev/null 2>&1
          ssh $nim "kill -9 `ssh $nim ps -ef | grep core | awk '{print $2}'| head -n 1`" >/dev/null 2>&1
      done
      
      #停止所有的supervisor
      for visor in $supervisorServers
      do
          echo 从节点 $visor 停止supervisor...[ done ]
          ssh $visor "kill -9 `ssh $visor ps -ef | grep supervisor | awk '{print $2}'| head -n 1`" >/dev/null 2>&1
      done
      
      
      • SHファイルには、実行権限を与えるために作成します

        chmod u+x start-storm-all.sh
        chmod u+x stop-storm-all.sh
      • vimのは/ etc /ストームパスを追加して、環境変数を変更プロフィール

        export STORM_HOME=/opt/ronnie/storm-2.0.0
        export PATH=$STORM_HOME/bin:$PATH
      • 開始と別の仮想マシンに転送設定ファイルを停止する(それだけでスタンバイノードを変更することを忘れ、主にマスターノードです)

        scp start-storm-all.sh [email protected]:/opt/ronnie/storm-2.0.0/bin/
        scp start-storm-all.sh [email protected]:/opt/ronnie/storm-2.0.0/bin/
        scp stop-storm-all.sh [email protected]:/opt/ronnie/storm-2.0.0/bin/
        scp stop-storm-all.sh [email protected]:/opt/ronnie/storm-2.0.0/bin/
      • スタート飼育係:zkServer.sh開始

      • 嵐を起動します。

        start-storm-all.sh
        # 关闭
        stop-storm-all.sh

        1571502877850

1571502914909

おすすめ

転載: www.cnblogs.com/ronnieyuan/p/11706472.html