安装JStorm2.1.1

来源:互联网 发布:mac怎么同时登陆2个qq 编辑:程序博客网 时间:2024/06/07 02:47

安装zookeeper

参见

http://www.cnblogs.com/ilovexiao/p/3946547.html

不过这篇博客有个问题
/datatmp/zookeeper/logs
这个文件夹是需要手动新建的


安装python

Centos7本身已经自带了Python2.7.5
使用python -V即可查看python的版本


安装JStorm

wget http://42.121.19.155/jstorm/jstorm-2.1.1.zip
unzip jstorm-2.1.1.zip
cd jstorm-2.1.1
修改配置文件conf/storm.yaml
我的storm.yaml如下: (已经去掉注释)
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. ########### These MUST be filled in for a storm configuration  
  2.  storm.zookeeper.servers:  
  3.      - "10.105.23.114"  
  4.   
  5.   
  6.  storm.zookeeper.root: "/jstorm"  
  7.   
  8.   
  9.   
  10.   
  11.  nimbus.host: "10.105.23.114"  
  12.  nimbus.host.start.supervisor: false  
  13.    
  14.  nimbus.childopts: "-Xmx256m"  
  15.  supervisor.childopts: "-Xmx256m"  
  16.  worker.childopts: "-Xmx128m"  
  17.   
  18.   
  19.   
  20.   
  21.  storm.local.dir: "%JSTORM_HOME%/data"  
  22.   
  23.   
  24.  supervisor.slots.ports:  
  25.     - 6800  
  26.     - 6801  
  27.     - 6802  
  28.     - 6803  

yaml文件的格式比较麻烦 在这里,我就说一点 
在缩排中空白字符的数目并不是非常重要,只要相同阶层的元素左侧对齐就可以了(不过不能使用TAB字符);
我的/etc/hosts
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. 127.0.0.1    localhost  
  2. 10.105.23.114   VM_23_114_centos  


在~/bashrc末尾加入:
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. export JSTORM_HOME=/usr/local/jstorm-2.1.1  
  2. export PATH=$PATH:$JSTORM_HOME/bin  
然后 使环境变量生效:
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. source ~/.bashrc  
配置完上面内容后,需要创建~/.jstorm目录,并将配置好的storm.yaml文件拷贝到该目录下:
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. mkdir ~/.jstorm  
  2. cp -f /usr/local/jstorm-2.1.1/conf/storm.yaml ~/.jstorm  


安装JStorm UI

jstorm的安装目录下就有 jstorm-ui-2.1.1.war
先安装tomcat
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.zip  
  2. unzip apache-tomcat-7.0.57.zip  
  3. cd apache-tomcat-7.0.57  
  4. chmod +x bin/*.sh  
把放到tomcat的webapps的ROOT里,如果jstorm-ui-2.1.1只当做一个普通的项目与ROOT并列,会发现运行的时候JStorm有些图片显示不出来
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. cp ~/jstorm-2.1.1/jstorm-ui-2.1.1.war webapps/  
  2. mv ROOT ROOT.old  
  3. ln -s jstorm-ui-0.9.6.2 ROOT  

java测试代码

见http://blog.csdn.net/xeseo/article/details/17683049




启动JStorm

在jstorm-2.1.1/bin下
先启动nimbus与supervisor
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. nohup jstorm nimbus &  
  2. nohup jstorm supervisor &  
然后去
/usr/local/jstorm-2.1.1/logs
下看nimbus.log与supervisor.log
看是否有错误
然后启动
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. ./jstorm jar storm-samples.jar mystorm.ExclaimBasicTopo test  
storm-samples.jar是之前的测试代码打成的jar包
mystorm.ExclaimBasicTopo是启动类
最后的test就是Topologyname
另外 再说明一下,那个jar里面是没有storm的依赖包的,就只有我们写的那些类
jstorm-2.1.1/lib下有需要的外部jar


查看JStormUI

访问182.254.145.66:8080
如下:





参考资料

 JStorm-0.9.6.2安装配置
http://blog.csdn.net/shcyd/article/details/1354618 
Error contacting service. It is probably not running 错误
点击打开链接  Storm系列之最基本的例子
   Storm详解二、写第一个Storm应用
0 0
原创粉丝点击