教程:http://ifeve.com/getting-started-with-stom-index/
安装:http://shiyanjun.cn/archives/934.html
1:机器分配
系统:centos 6.5
nimbus 节点:192.168.136.129
supervisor 节点:192.168.136.130/131
软件分配置:zookeeper 、zeromq 、jzmq 、依赖包:129、130、131
storm-nimbus:129
storm-supervisor:130、131
准备工作:
修改别名:vim /etc/hosts
192.168.136.129 hadoop1
192.168.136.130 hadoop2
192.168.136.131 hadoop3
修改主机名(每台机器各不同):vim /etc/sysconfig/network
HOSTNAME=hadoop1
关闭iptables和SELinux(查看selinux状态:/usr/sbin/sestatus -v )
service iptables stop && chkconfig iptables off
setenforce 0
vim /etc/selinux/config
SELINUX=disabled
禁用ipv6(重启后ifconfig | grep -i inet6 无输出即可)
vim /etc/sysconfig/network
NETWORKING_IPV6=no
vim /etc/hosts
注释:::1 localhost localhost6 localhost6.localdomain6
vim /etc/modprobe.d/dist.conf
增加:alias net-pf-10 off
alias ipv6 off
打通ssh
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
hadoop1上执行:scp ~/.ssh/authorized_keys root@hadoop2:~/.ssh/
scp ~/.ssh/authorized_keys root@hadoop3:~/.ssh/
2:安装
1):下载:http://storm.apache.org/downloads.html
wget http://apache.fayea.com/storm/apache-storm-0.10.0/apache-storm-0.10.0.tar.gz
wget http://apache.fayea.com/zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz
wget http://download.zeromq.org/zeromq-2.1.7.tar.gz
安装依赖:yum install gcc-c++ -y
yum install libtool -y
yum install libuuid-devel.x86_64 -y
2):安装zookeeper
tar -zxvf zookeeper-3.3.6.tar.gz && cd zookeeper-3.3.6/conf
创建 vim zoo.cfg
tickTime=2000
dataDir=/var/zookeeper
clientPort=2181
initLimit=10
syncLimit=5
server.1=hadoop1:2887:3887
server.2=hadoop2:2887:3887
server.3=hadoop3:2887:3887
dataDir 是zookeeper用来存放文件的目录,保证用户有读写权限:mkdir /var/zookeeper && chmod 755 /var/zookeeper 启动:./zkServer.sh start
验证:echo ruok|nc localhost 2181 返回imok即成功
问题:
报:/var/zookeeper/myid file is missing
解决:第台机器上执行: echo 1 > /var/zookeeper/myid (每台机器数字不同)
问题:IllegalArgumentException: serverid is not a number
myid 为数字,并且要与zoo.cfg中的server.n对应
3):安装zeromq
tar -zxvf zeromq-2.1.7.tar.gz && cd zeromq-2.1.7
./configure
make
make install
4):安装jzmq
yum -y install git
git config --global user.name author #将用户名设为author
git config --global user.email [email protected] #将用户邮箱设为[email protected]
git clone https://github.com/nathanmarz/jzmq.git && cd jzmq
./autogen.sh
./configure
make
make install
5):安装storm
tar -zxvf apache-storm-0.10.0.tar.gz && cd apache-storm-0.10.0
编辑: vim conf/storm.yaml(主机只用配置zookeeper,supervisor须要全部配置)
hadoop1上配置
storm.zookeeper.servers:
- "hadoop1"
- "hadoop2"
- "hadoop3"
ui.port: 8082
hadoop2/3上配置
storm.zookeeper.servers:
- "hadoop1"
- "hadoop2"
- "hadoop3"
nimbus.host: "hadoop1"
storm.local.dir: "/root/storm/workdir"
supervisor.slots.ports:
- 6700
- 6701
- 6702
storm.zookeeper.servers:zookeeper地址,可有多个
nimbus.host:jobtrank地址 supervisor.slots. ports:tasktrank上可运行的work所占用的端口,可有多个
ui.port:重定向ui的端口
mkdir -p /root/storm/workdir && chmod 755 /root/storm/workdir
6):启动
启动nimbus(启一个) : bin/storm nimbus >/dev/null 2>&1 &
启动supervisor(在每个tasktrank上运行): bin/storm supervisor >/dev/null 2>&1 &
启动ui: bin/storm ui >/dev/null 2>&1 &
启动后可在ie中查看状态:http://192.168.136.129:8082/index.html
7):测试
http://isuifengfei.iteye.com/blog/1998269