<commit_before>---
layout: post
title: "Esper入门"
categories: CEP
tags: CEP Esper
author: Kopite
---

* content
{:toc}


本文介绍`kafka-manager`工具的使用。



## 安装kafka-manager

从[kafka-manager GitHub](https://github.com/yahoo/kafka-manager)下载的源码包需要编译，此处使用已经编译好的`kafka-manager-1.3.3.18.zip`，安装步骤如下：
* 使用[Bitvise SSH Client](https://www.bitvise.com/ssh-client)工具将编译好的`kafka-manager-1.3.3.18.zip`复制到`/usr/local/`路径，此处使用`192.168.80.129`
* 将`kafka-manager-1.3.3.18.zip`包解压至`/usr/local/`路径：

```
[root@localhost local]# unzip kafka-manager-1.3.3.18.zip
Archive:  kafka-manager-1.3.3.18.zip
  inflating: kafka-manager-1.3.3.18/lib/kafka-manager.kafka-manager-1.3.3.18-sans-externalized.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.twirl-api_2.11-1.1.1.jar  
  inflating: kafka-manager-1.3.3.18/lib/org.apache.commons.commons-lang3-3.4.jar  
  inflating: kafka-manager-172.16.17.32/lib/com.typesafe.play.play-server_2.11-2.4.6.jar  
  inflating: kafka-manager-172.16.17.32/lib/com.typesafe.play.play_2.11-2.4.6.jar  
  inflating: kafka-manager-172.16.17.32/lib/com.typesafe.play.build-link-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.play-exceptions-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/org.javassist.javassist-3.19.0-GA.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.play-iteratees_2.11-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/org.scala-stm.scala-stm_2.11-0.7.jar
...
```

* 进入`/usr/local/kafka-manager-1.3.3.18/conf`目录，修改`application.conf`，保存并关闭：

```
kafka-manager.zkhosts="192.168.80.129:2181,192.168.80.130:2181,192.168.80.131:2181"
```

## 启动kafka-manager

`kafka-manager`默认访问端口是`9000`，开放此端口：

```
[root@localhost conf]# firewall-cmd --query-port=9000/tcp
no
[root@localhost conf]# firewall-cmd --permanent --zone=public --add-port=9000/tcp
success
[root@localhost conf]# firewall-cmd --reload
success
[root@localhost conf]# firewall-cmd --query-port=9000/tcp
yes
```

使用以下命令启动`kafka-manager`，浏览器中输入`http://192.168.80.129:9000`即可访问`kafka-manager`：

```
[root@localhost bin]# ./kafka-manager
```

## 使用kafka-manager

### Add Cluster

![](/image/2018/2018-12-03-kafka-manager-1.PNG)

点击`Cluster`->`Add Cluster`，进入上图中所示的新增集群界面，依次输入`Cluster Name`、`Cluster Zookeeper Hosts`、`Kafka Version`，点击`Save`保存，新增集群后的界面如下图所示：

![](/image/2018/2018-12-03-kafka-manager-2.PNG)

点击集群名称进入`Summary`界面：

![](/image/2018/2018-12-03-kafka-manager-3.PNG)

在`Summary`界面可查看`Topics`、`Brokers`：

![](/image/2018/2018-12-03-kafka-manager-4.PNG)

![](/image/2018/2018-12-03-kafka-manager-5.PNG)

### Create Topic

![](/image/2018/2018-12-03-kafka-manager-6.PNG)

点击`Topic`->`Create Topic`，进入上图中所示的新增主题界面，依次输入`Topic`、`Partitions`、`Replication Factor`，点击`Create`保存，新增主题后的界面如下图所示：

![](/image/2018/2018-12-03-kafka-manager-7.PNG)

* [参考：复杂事件处理引擎—Esper（一）](https://www.cnblogs.com/aking1988/p/Esper-quick-start.html)
* [参考：复杂事件处理引擎—Esper（二）](https://www.cnblogs.com/aking1988/p/3281649.html)
* [参考：复杂事件处理引擎—Esper（三）](https://www.cnblogs.com/aking1988/p/3288215.html)
* [参考：复杂事件处理引擎—Esper（四）](https://www.cnblogs.com/aking1988/p/3300124.html)
* [参考：复杂事件处理引擎—Esper（五）](https://www.cnblogs.com/aking1988/p/3313634.html)
* [参考：Esper复杂事务处理一小时入门](https://www.cnblogs.com/1024Community/p/8644632.html)
* [参考：复合事件处理（Complex Event Processing）介绍](https://www.cnblogs.com/shanyou/archive/2010/09/16/cep.html)<commit_msg>edit esper file<commit_after>---
layout: post
title: "Esper入门"
categories: CEP
tags: CEP Esper
author: Kopite
---

* content
{:toc}


本文介绍`kafka-manager`工具的使用。



## 安装kafka-manager

从[kafka-manager GitHub](https://github.com/yahoo/kafka-manager)下载的源码包需要编译，此处使用已经编译好的`kafka-manager-1.3.3.18.zip`，安装步骤如下：
* 使用[Bitvise SSH Client](https://www.bitvise.com/ssh-client)工具将编译好的`kafka-manager-1.3.3.18.zip`复制到`/usr/local/`路径，此处使用`192.168.80.129`
* 将`kafka-manager-1.3.3.18.zip`包解压至`/usr/local/`路径：

```
[root@localhost local]# unzip kafka-manager-1.3.3.18.zip
Archive:  kafka-manager-1.3.3.18.zip
  inflating: kafka-manager-1.3.3.18/lib/kafka-manager.kafka-manager-1.3.3.18-sans-externalized.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.twirl-api_2.11-1.1.1.jar  
  inflating: kafka-manager-1.3.3.18/lib/org.apache.commons.commons-lang3-3.4.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.play-server_2.11-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.play_2.11-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.build-link-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.play-exceptions-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/org.javassist.javassist-3.19.0-GA.jar  
  inflating: kafka-manager-1.3.3.18/lib/com.typesafe.play.play-iteratees_2.11-2.4.6.jar  
  inflating: kafka-manager-1.3.3.18/lib/org.scala-stm.scala-stm_2.11-0.7.jar
...
```

* 进入`/usr/local/kafka-manager-1.3.3.18/conf`目录，修改`application.conf`，保存并关闭：

```
kafka-manager.zkhosts="192.168.80.129:2181,192.168.80.130:2181,192.168.80.131:2181"
```

## 启动kafka-manager

`kafka-manager`默认访问端口是`9000`，开放此端口：

```
[root@localhost conf]# firewall-cmd --query-port=9000/tcp
no
[root@localhost conf]# firewall-cmd --permanent --zone=public --add-port=9000/tcp
success
[root@localhost conf]# firewall-cmd --reload
success
[root@localhost conf]# firewall-cmd --query-port=9000/tcp
yes
```

使用以下命令启动`kafka-manager`，浏览器中输入`http://192.168.80.129:9000`即可访问`kafka-manager`：

```
[root@localhost bin]# ./kafka-manager
```

## 使用kafka-manager

### Add Cluster

![](/image/2018/2018-12-03-kafka-manager-1.PNG)

点击`Cluster`->`Add Cluster`，进入上图中所示的新增集群界面，依次输入`Cluster Name`、`Cluster Zookeeper Hosts`、`Kafka Version`，点击`Save`保存，新增集群后的界面如下图所示：

![](/image/2018/2018-12-03-kafka-manager-2.PNG)

点击集群名称进入`Summary`界面：

![](/image/2018/2018-12-03-kafka-manager-3.PNG)

在`Summary`界面可查看`Topics`、`Brokers`：

![](/image/2018/2018-12-03-kafka-manager-4.PNG)

![](/image/2018/2018-12-03-kafka-manager-5.PNG)

### Create Topic

![](/image/2018/2018-12-03-kafka-manager-6.PNG)

点击`Topic`->`Create Topic`，进入上图中所示的新增主题界面，依次输入`Topic`、`Partitions`、`Replication Factor`，点击`Create`保存，新增主题后的界面如下图所示：

![](/image/2018/2018-12-03-kafka-manager-7.PNG)

* [参考：5分钟开启Esper之旅](https://www.cnblogs.com/Binhua-Liu/p/4646308.html)
* [参考：复杂事件处理引擎—Esper（一）](https://www.cnblogs.com/aking1988/p/Esper-quick-start.html)
* [参考：复杂事件处理引擎—Esper（二）](https://www.cnblogs.com/aking1988/p/3281649.html)
* [参考：复杂事件处理引擎—Esper（三）](https://www.cnblogs.com/aking1988/p/3288215.html)
* [参考：复杂事件处理引擎—Esper（四）](https://www.cnblogs.com/aking1988/p/3300124.html)
* [参考：复杂事件处理引擎—Esper（五）](https://www.cnblogs.com/aking1988/p/3313634.html)
* [参考：Esper复杂事务处理一小时入门](https://www.cnblogs.com/1024Community/p/8644632.html)
* [参考：复合事件处理（Complex Event Processing）介绍](https://www.cnblogs.com/shanyou/archive/2010/09/16/cep.html)
{'fraction_non_alphanumeric': 0.21007534347761855, 'fraction_numerical': 0.11286748411877677, 'mean_word_length': 4.558292282430213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 19, 'lorem ipsum': 0, 'www.': 17, 'xml': 0}, 'pii_count': 44, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '643893', 'n_tokens_mistral': 3874, 'n_tokens_neox': 3557, 'n_words': 222}