---
title: "JStorm2.1.1集群的安装和使用"
author: "wosyingjun"
date: "2016-08-12T09:39:21Z"
tags: ["Storm", "大数据"]
categories: ["企业架构"]
slug: "jstorm2-1-1"
draft: false
lastmod: "2016-08-12T09:43:04Z"
id: 2317034
url: "https://wosyingjun.iteye.com/blog/2317034"
---

### JStorm2.1.1集群的安装和使用

> Storm是一个免费开源、分布式、高容错的实时计算系统，而JStorm是阿里巴巴开源的基于Storm采用Java重写的一套分布式实时流计算框架，在性能和支持的集群规模上做了较大优化。

官方地址：[https://github.com/alibaba/jstorm](https://github.com/alibaba/jstorm)  
相关文章：[Storm深入理解](/blog/2316763)  
相关项目：[Leek——简易版实时智能选股平台](https://github.com/wosyingjun/Leek)

#### JStorm集群的安装:

 

##### 1、Zookeeper集群的安装

见：[ZooKeeper高可用集群的安装及配置](/blog/2312960)

##### 2、JStorm的安装(安装前需先安装JDK和Python)

 

###### 下载JStorm

```
wget https://github.com/alibaba/jstorm/wiki/Downloads
```

###### 在服务器A和服务器B上：

```
unzip jstorm-2.1.1
vim /etc/profile
#profile中添加如下内容：
export JSTORM_HOME=/XXXXX/XXXX
export PATH=$PATH:$JSTORM_HOME/bin
```

###### 在服务器A上配置：

```
 vim /home/jstorm/jstorm-2.1.1/conf/storm.yaml 

 storm.zookeeper.servers:
     - "192.168.xx.100"
     - "192.168.xx.101"
     - "192.168.xx.102"
 nimbus.host: "192.168.xx.100"
 storm.zookeeper.root: "/jstorm"
 storm.local.dir: "%JSTORM_HOME%/data"
 supervisor.slots.ports:
    - 6800
    - 6801
    - 6802
    - 6803
```

###### 在服务器B上配置：

```
 vim /home/jstorm/jstorm-2.1.1/conf/storm.yaml 

 storm.zookeeper.servers:
     - "192.168.xx.100"
     - "192.168.xx.101"
     - "192.168.xx.102"
 nimbus.host: "192.168.xx.100"
 storm.zookeeper.root: "/jstorm"
 storm.local.dir: "%JSTORM_HOME%/data"
 supervisor.slots.ports:
    - 6800
    - 6801
    - 6802
    - 6803
```

##### 3、在各个服务器提交jar的节点上执行:

```
mkdir ~/.jstorm
cp -f $JSTORM_HOME/conf/storm.yaml ~/.jstorm
```

##### 4、启动JStorm

 

###### 在服务器A上启动：

```
nohup jstorm nimbus &
nohup jstorm supervisor &
#查看启动情况
jps
```

###### 在服务器B上启动：

```
nohup jstorm supervisor &
#查看启动情况
jps
```

###### 在服务器A上部署TOPOLOGY

```
jstorm jar Leek-1.0-SNAPSHOT.jar com.yingjun.stock.topology.StockStategyTopology xxx
```

##### 注：TOPOLOGY的写法可参考项目：[Leek——简易版实时智能选股平台](https://github.com/wosyingjun/Leek)

 

##### 5、安装JStorm Web UI

```
mkdir ~/.jstorm
cp -f $JSTORM_HOME/conf/storm.yaml ~/.jstorm
#下载tomcat 7.x （以apache-tomcat-7.0.37 为例）
tar -xzf apache-tomcat-7.0.37.tar.gz
cd apache-tomcat-7.0.37
cd webapps
cp $JSTORM_HOME/jstorm-ui-0.9.6.3.war ./
../bin./startup.sh
访问地址：http://192.168.xx.xxx:8080/jstorm-ui-2.1.1/
```

###### 效果图：

![](http://i.imgur.com/JL4p1gV.jpg)