(一)stormのクラスタインストールと構成

4582 ワード

マシン:
192.168.180.101
192.168.187.16
必要なソフトウェアは次のとおりです.
zookeeper(zookeeper-3.4.4.tar.gz),storm(storm-0.8.1.zip) ,jdk
1、zookeeperを配置する
zookeeperを解凍し、confディレクトリの下のzoo_をsample.cfgの名前は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=/data/zookeeper/data
dataLogDir=/data/zookeeper/log
# the port at which the clients will connect
clientPort=2181
#
# 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
server.1=192.168.187.16:2888:3888
server.2=192.168.180.101:2888:3888

具体的な構成は以下を参照してください.http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_configuration
最後の2行の構成に注意してください.
フォーマット:server.id=host:port:port
idは数字1-255のみで、dataDirディレクトリの下にmyidというファイルを新規作成する必要があります.その内容は1行だけです.「id」
Every machine that is part of the ZooKeeper ensemble should know about every other machine in the ensemble. You accomplish this with the series of lines of the form server.id=host:port:port. The parameters host and port are straightforward. You attribute the server id to each machine by creating a file named myid, one for each server, which resides in that server's data directory, as specified by the configuration file parameter dataDir.
次に、環境変数を追加する必要があります.
export ZOOKEEPER_HOME=/home/zhxia/apps/db/zookeeper
2台のマシンの環境構成は同じですがmyidファイル内のidは異なります
2、stormの構成
解凍storm
confディレクトリに入りstormを編集します.yamlファイル
########## These MUST be filled in for a storm configuration
 storm.zookeeper.servers:
     - "192.168.187.16"
     - "192.168.180.101"

 nimbus.host: "192.168.187.16"

 storm.local.dir: "/data/storm/data"
 ##### 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:
    # - "127.0.0.1"
     #- "server2"
## to nimbus 
#nimbus.childopts: "-Xmx1024m" 
#
## to supervisor 
#supervisor.childopts: "-Xmx1024m" 
#
## to worker 
#worker.childopts: "-Xmx768m" 

構成が完了したらzookeeperとstormの起動を開始します
zookeeperの起動
bin/zkServer.sh start
スタートstorm
bin/storm nimbus
bin/storm supervisor
bin/storm ui
ブラウザが開きます.http://localhost:8080クラスタの実行ステータスの表示