Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | About

第 135 章 Twitter Storm

目錄

135.1. 單機版
135.2. lein 安裝

135.1. 單機版

操作系統環境:Ubuntu 13.04 KVM虛擬機

安裝 storm 涉及到安裝以下包:python、zookeeper、zeromq、jzmq、storm

過程 135.1. Ubuntu + Storm 單機環境安裝

  1. 安裝 zookeeper

    $ sudo apt-get install zookeeper zookeeper-bin zookeeperd
    				
  2. 安裝 zeromq 與 jzmq

    $ sudo apt-get install openjdk-7-jdk
    $ sudo apt-get install libzmq-dev
    				

    設置 JAVA_HOME 環境變數

    $ export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
    				

    編譯安裝 jzmq

    				
    $ cd /usr/local/src/
    $ git clone git://github.com/nathanmarz/jzmq.git
    $ cd jzmq
    $ ./autogen.sh
    $ ./configure --prefix=/srv/jzmq-2.1.0
    $ javac src/org/zeromq/*.java
    $ touch src/classdist_noinst.stamp
    $ make && make install
    
    $ ls /srv/jzmq-2.1.0/
    lib  share
    				
    				
  3. 安裝 Storm

    下載地址:https://github.com/nathanmarz/storm/downloads

    $ sudo apt-get install unzip
    
    $ cd /usr/local/src/
    $ $ wget https://github.com/downloads/nathanmarz/storm/storm-0.8.1.zip
    $ unzip storm-0.8.1.zip
    $ $ sudo mv storm-0.8.1 /srv/
    $ sudo ln -s /srv/storm-0.8.1 /srv/storm
    				

    				
    cat >> ~/.bashrc <<'EOF'
    
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
    export ZOOKEEPER_HOME="/usr/lib/zookeeper"
    export STORM_HOME=/srv/storm
    export PATH=$PATH:$PATH:$ZOOKEEPER_HOME/bin:$STORM_HOME/bin
    EOF
    				
    				

    修改 Storm CONF_DIR 目錄位置

    $ sed -i 's:CONF_DIR = os.path.expanduser("~/.storm"):CONF_DIR = "/srv/storm-0.8.1/conf":' /srv/storm/bin/storm
    				
  4. 啟動服務

    啟動 zookeeper 服務

    $ sudo service zookeeper start
    				

    啟動 storm 服務

    				
    /srv/storm/bin/storm nimbus &
    /srv/storm/bin/storm supervisor &
    /srv/storm/bin/storm ui &
    				
    				

    Storm UI

    http://192.168.6.2:8080/

    查看 Java 進程

    $ jps
    10382 Jps
    10228 supervisor
    10294 core
    10173 nimbus
    				
  5. 測試 Storm

    $ sudo apt-get install maven2
    
    $ git clone git://github.com/nathanmarz/storm-starter
    $ cd storm-starter
    $ mvn -f m2-pom.xml package
    				

    先進入Storm UI http://192.168.6.2:8080/, 然後運行下面與命令

    $ storm jar target/storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.WordCountTopology wordcountTop
    				

    在次進入 Storm UI 你會看到 wordcountTop