storm伪集群环境搭建

来源:互联网 发布:led灯 知乎 编辑:程序博客网 时间:2024/06/07 08:09

准备工作:
1、zookeeper-3.4.10.tar.gz
网盘地址:http://pan.baidu.com/s/1kV3cJ4b 提取码:8mxa
2、apache-storm-1.1.0.tar.gz
网盘地址:http://pan.baidu.com/s/1kVNv2Wf 提取码:yh42

单机模式(伪集群)

  1. 安装zookeeper:

将下载的zookepper安装文件放入/usr/local/目录下并解压文件

root@mylinux local]# tar -zxvf zookeeper-3.4.10.tar.gz

编辑配置文件,创建一个zoo.cfg文件,可从zoo_simple.cfg复制

[root@mylinux local]# cd zookeeper-3.4.10/conf/[root@mylinux conf]# cp zoo_sample.cfg zoo.cfg[root@mylinux conf]# vi zoo.cfg

修改配置文件zoo.cfg内容如下:

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/usr/local/zookeeper-3.4.10/data# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the # administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeInterval=1

只需修改dataDir=/usr/local/zookeeper-3.4.10/data这一行,指定数据存储位置。
启动zookeeper:

[root@mylinux zookeeper-3.4.10]# cd /usr/local/zookeeper-3.4.10[root@mylinux zookeeper-3.4.10]# ./bin/zkServer.sh start

看到如下信息说明zookeeper启动成功

ZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... STARTED

2、安装storm
将storm安装文件放入/usr/local/目录下,并解压文件

[root@mylinux local]# tar -zxvf apache-storm-1.1.0.tar.gz

进入目录下修改配置文件:

[root@mylinux local]# cd apache-storm-1.1.0/conf/[root@mylinux conf]# vi storm.yaml

在storm.yaml中加入以下配置:

storm.zookeeper.servers:     - "localhost"nimbus.seeds: ["localhost"]drpc.servers:    - "localhost"storm.local.dir: "/usr/local/apache-storm-1.1.0/local-dir"

启动storm:

[root@mylinux ~]# cd /usr/local/apache-storm-1.1.0/bin/[root@mylinux bin]# storm nimbus > /dev/null 2>&1 &[root@mylinux bin]# storm supervisor > /dev/null 2>&1 &[root@mylinux bin]# storm drpc > /dev/null 2>&1 &[root@mylinux bin]# storm ui > /dev/null 2>&1 &

查看启动是否成功(启动较慢,需要多等一会):

[root@mylinux bin]#netstat -lnp |grep java

以下为启动成功界面:
这里写图片描述

可已通过ui界面查看storm运行状态,浏览器访问:http://ip/8080
这里写图片描述
如果访问失败关闭防火墙后重试(关闭防火墙命令:service iptables stop)
注:如果启动storm失败可进入storm安装目录logs文件夹下查看失败原因,如:nimbus错误日志在numbus.log,supervisor日志在supervisor.log …

原创粉丝点击