准备工作
准备3台机器,分别命名为:
- master
- slave1
- slave2
设置SSH使master免密码登陆slave1、slave2。
测试安装先关闭3台机器防火墙。
systemctl stop firewalld.service
- 安装jdk
- 验证python是否已安装 python –version
安装Zookeeper集群
下载zookeeper
官网:http://www.apache.org/dyn/closer.cgi/zookeeper/
放到/usr/下
tar -xzvf zookeeper-3.5.2-alpha.tar.gz
mv zookeeper-3.5.2-alpha.tar.gz /opt
cd /opt/zookeeper-3.5.2-alpha/conf
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
内容:
tickTime=2000
dataDir=/opt/zookeeper-3.5.2-alpha/data
clientPort=2181
initLimit=5
syncLimit=2
server.0=master:2888:3888
server.1=slave1:2888:3888
server.2=slave2:2888:3888
拷贝:
scp -r /opt/zookeeper-3.5.2-alpha root@slave1:/opt/
scp -r /opt/zookeeper-3.5.2-alpha root@slave2:/opt/
在master,slave1,slave2上分别修改:
vi /opt/zookeeper-3.5.2-alpha/data/myid
内容分别为0 1 2
在slave1和slave2上运行:
cd /opt/zookeeper-3.5.2-alpha/bin
./zkServer.sh start
添加path
vi /etc/profile
ZOOKEEPER_HOME=/opt/zookeeper-3.5.2-alpha
PATH=$PATH:$ZOOKEEPER_HOME/bin
source /etc/profile
这样可以直接运行zkServer.sh start
检查运行情况
运行
/opt/zookeeper-3.5.2-alpha/bin/zkServer.sh status
问题处理
如果提示:
Error Contacting service.It is probably not running.
netstat -ptnl | grep 2181
kill -9 7388(用上面命令显示结果的实际端口号)
zkServer.sh stop
zkServer.sh start
安装Storm
安装依赖库
yum install libtool
yum install gcc
yum install gcc-c++
yum install make
yum install uuid-devel
yum install libuuid-devel
yum install e2fsprogs-devel
下载libsodium
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.10.tar.gz
tar -xzvf libsodium-1.0.11.tar.gz
./autogen.sh
./configure
make
make install
ZeroMQ4.1.4
cd /opt/
wget https://ia800405.us.archive.org/21/items/zeromq_4.1.4/zeromq-4.1.4.tar.gz
tar -xzf zeromq-4.1.4.tar.gz
cd zeromq-4.1.4
# 下面这一句不要执行,在这里备用
# ./configure --with-libsodium=/opt/libsodium-1.0.11 --with-libsodium-include-dir=/opt/libsodium-1.0.11/src/libsodium/include --with-libsodium-lib-dir=/usr/lib64
./autogen.sh
./configure PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
make
sudo make install
如果提示uuid找不到,则
sudo yum install e2fsprogsl -b current
sudo yum install e2fsprogs-devel -b current
jzmq
git clone git://github.com/zeromq/jzmq.git
./autogen.sh
./configure
下载storm
http://storm.apache.org/downloads.html
wget "http://apache.opencas.org/storm/apache-storm-1.0.0/apache-storm-1.0.0.tar.gz"
tar -xzvf apache-storm-1.0.0.tar.gz
mv apache-storm-1.0.0 /opt
rm apache-storm-1.0.0.tar.gz
cd /opt/apache-storm-1.0.0
修改storm.yaml
cd /opt/apache-storm-1.0.0/conf
vi storm.yaml
内容:
storm.zookeeper.servers:
- "master" - "slave1" - "slave2"
storm.local.dir: "/opt/apache-storm-1.0.0/data"
nimbus.seeds: ["master"]
拷贝:
scp -r apache-storm-1.0.0 root@slave1:/opt
scp -r apache-storm-1.0.0 root@slave2:/opt
启动:
主控结点:
/opt/apache-storm-1.0.0/bin/storm nimbus &
工作结点:
/opt/apache-storm-1.0.0/bin/storm supervisor &
启动管理界面
主控结点上运行:
/opt/apache-storm-1.0.0/bin/storm ui
http://master:8080 查看管理界面