zookeeper+kafka集群部署+storm集群

一、环境安装前准备:

准备三台机器

操作系统:centos6.8

jdk:jdk-8u111-linux-x64.gz

zookeeper:zookeeper-3.4.11.tar.gz

kafka: kafka_2.11-1.0.1.tgz

storm:apache-storm-1.2.2.tar.gz

配置/etc/hosts(三台上都操作)

vi /etc/hosts

192.168.1.211 canal01

192.168.1.212 canal02

192.168.1.213 canal03

二、jdk安装(三台)

2.1解压软件

tar zxvf jdk-8u111-linux-x64.gz

mv  jdk-8u111-linux-x64 /usr/local/jdk

2.2配置环境变量

vi /etc/profile

#java

JAVA_HOME=/usr/local/jdk

PATH=$JAVA_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME

export PATH

export CLASSPATH

环境变量生效

source /etc/profile

三、zookeeper集群安装(三台上操作)

3.1解压软件

tar zxvf zookeeper-3.4.11.tar.gz

mv zookeeper-3.4.11 /usr/local/zookeeper

cd /usr/local/zookeeper/conf

mv  mv zoo_sample.cfg zoo.cfg

3.2、配置zoo.cfg

vi zoo.cfg

#修改

dataDir=/usr/local/zookeeper/data

#添加

dataLogDir=/usr/local/zookeeper/logs

server.1=192.168.1.211:2888:3888

server.2=192.168.1.212:2888:3888

server.3=192.168.1.213:2888:3888

3.3、创建目录

mkdir /usr/local/zookeeper/data

mkdir /usr/local/zookeeper/logs

在192.168.1.211操作

echo "1" >/usr/local/zookeeper/data/myid

在192.168.1.212操作

echo "2" >/usr/local/zookeeper/data/myid

在192.168.1.213操作

echo "3" >/usr/local/zookeeper/data/myid

3.4、启动zookeeper

cd /usr/local/zookeeper/bin/

./zkServer.sh start

3.5、查看状态

cd /usr/local/zookeeper/bin/

./zkServer.sh status

注意:查看zookeeper集群的状态,出现Mode:follower或是Mode:leader则代表成功

四、kafka集群安装(三台上操作)

4.1解压软件

tar zxvf  kafka_2.11-1.0.1.tgz

mv kafka_2.11-1.0.1 /usr/local/kafka

4.2配置kafka(在三台分别操作)

在192.168.1.211操作

cd /usr/local/kafka/config/

cp server.properties server0.properties

vi server0.properties

#修改

broker.id=0

zookeeper.connect=192.168.1.211:2181,192.168.1.212:2181,192.168.1.213:2181

在192.168.1.212操作

cd /usr/local/kafka/config/

cp server.properties server0.properties

vi server0.properties

#修改

broker.id=1

zookeeper.connect=192.168.1.211:2181,192.168.1.212:2181,192.168.1.213:2181

在192.168.1.213操作

cd /usr/local/kafka/config/

cp server.properties server0.properties

vi server0.properties

#修改

broker.id=2

zookeeper.connect=192.168.1.211:2181,192.168.1.212:2181,192.168.1.213:2181

4.3启动kafka(采用后台启动方式)

/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server0.properties

s01.png

查看日志是否成功

cd /usr/local/kafka/logs

tail -200 kafkaServer.out

zookeeper+kafka集群部署+storm集群_第1张图片

以上图说明成功,没有报错

五、storm集群安装(三台都操作)

5.1、解压软件

tar zxvf apache-storm-1.2.2.tar.gz

mv apache-storm-1.2.2 /usr/local/storm

5.2、配置storm

cd /usr/local/storm/conf/

vi storm.yaml

##配置

storm.zookeeper.servers:

- "192.168.1.211"

- "192.168.1.212"

- "192.168.1.213"

storm.zookeeper.port: 2181

nimbus.seeds: ["canal01"]

storm.local.dir: "/usr/local/storm/storm-local"

supervisor.slots.ports:

- 6700

- 6701

- 6702

- 6703

storm.health.check.dir: "healthchecks"

storm.health.check.timeout.ms: 5000

5.3、配置环境变量

vi /etc/profile

##storm

export STORM_HOME=/usr/local/storm

export PATH=${STORM_HOME}/bin:$PATH

环境变量生效

source /etc/profile

5.4、启动storm

在192.168.1.211操作

storm nimbus >/dev/null 2>&1 &

storm ui &

在192.168.1.212操作

storm supervisor >/dev/null 2>&1 &

在192.168.1.213操作

storm supervisor >/dev/null 2>&1 &


访问strom http://192.168.1.211:8080

zookeeper+kafka集群部署+storm集群_第2张图片