3臺機器部署storm-1.1.0叢集
阿新 • • 發佈:2018-12-26
一. 環境介紹
三臺主機,主機名和ip分別為: ubuntu1 10.3.19.171 ubuntu2 10.3.19.172 ubuntu3 10.3.19.173三臺主機的登入使用者名稱是bigdata,home目錄是/home/bigdata 現在三臺主機上部署storm叢集。 storm需要使用python,安裝python如下:
[email protected]:~$ sudo apt-get install python
二. 解壓複製storm安裝包到ubuntu1
[email protected]:~/download$ tar -zxvf apache-storm-1.1.0.tar.gz
[email protected]:~/download$ mv apache-storm-1.1.0 ../run/
[email protected]:~/download$ cd ../run/
[email protected]:~/run$ ln -s apache-storm-1.1.0 storm
三. 修改ubuntu1上storm的配置檔案
建立Nimbus 和 Supervisor 後臺程序所需要的local目錄[email protected]:~$ mkdir /home/bigdata/run/storm/storm_workdir
修改配置檔案:[email protected] :~/run$ cd storm/conf/
[email protected]:~/run/storm/conf$ cat storm.yaml
......
storm.zookeeper.servers:
- "10.3.19.171"
- "10.3.19.172"
- "10.3.19.173"
nimbus.host: "10.3.19.171"
ui.port: 9090
storm.local.dir: "/home/bigdata/run/storm/storm_workdir"
四. 在ubuntu2 ubuntu3上安裝storm
為了安裝方便,直接將ubuntu1上的storm打包,拷貝到ubuntu1和ubuntu2主機上,操作如下: [email protected]:~/run$ tar -zcvf apache-storm-1.1.0.tar.gz apache-storm-1.1.0
[email protected]:~/run$ scp apache-storm-1.1.0.tar.gz ubuntu2:/home/bigdata/run/
[email protected]:~/run$ scp apache-storm-1.1.0.tar.gz ubuntu3:/home/bigdata/run/
在ubuntu2 ubuntu3上解壓,並建立軟連線。ubuntu2操作如下,ubuntu3類似。[email protected]:~/run$ tar -zxvf apache-storm-1.1.0.tar.gz
[email protected]:~/run$ ln -s apache-storm-1.1.0 storm
至此,已成功將storm部署到ubuntu1 ubuntu2 ubuntu3三臺機器上。
五. 啟動storm
ubuntu1作為master, 在其它執行操作:[email protected]:~/run/storm/bin$ ./storm nimbus &
[email protected]:~/run/storm/bin$ ./storm ui &
[email protected]:~/run/storm/bin$ ./storm supervisor &
ubuntu2 ubuntu3作為從節點,只需要執行:[email protected]:~/run/storm/bin$ ./storm supervisor &
檢視storm程序是否啟動:
[email protected]:~/run/storm/bin$ jps -l | grep storm
5370 org.apache.storm.ui.core
5454 org.apache.storm.daemon.supervisor.Supervisor
5263 org.apache.storm.daemon.nimbus
[email protected]:~/run/storm/bin$ jps -l | grep storm
3189 org.apache.storm.daemon.supervisor.Supervisor
六. 測試
使用瀏覽器檢視storm介面:http://10.3.19.171:9090七.編譯示例程式原始碼&&執行測試命令測試:
[email protected]:~$ cd /home/bigdata/run/storm/examples/storm-starter
[email protected]:~/run/storm/examples/storm-starter$ mvn package
[email protected]:~/run/storm/examples/storm-starter$ ls
dependency-reduced-pom.xml multilang pom.xml README.markdown src target test
[email protected]:~/run/storm/examples/storm-starter$ cd target/
[email protected]:~/run/storm/examples/storm-starter/target$ ls
classes generated-test-sources maven-shared-archive-resources original-storm-starter-1.1.0.jar surefire-reports
generated-sources maven-archiver maven-status storm-starter-1.1.0.jar test-classes
[email protected]:~/run/storm/examples/storm-starter/target$ cd ../../../bin/
[email protected]:~/run/storm/bin$ ./storm jar ../examples/storm-starter/target/storm-starter-1.1.0.jar org.apache.storm.starter.WordCountTopology wordcount