You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2021/08/29 10:49:26 UTC

[incubator-inlong-website] branch master updated: add example demo (#133)

This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 66381c5  add example demo (#133)
66381c5 is described below

commit 66381c5ebef93cdea545b0fbbbdf768417497b0d
Author: Bowen Li <27...@qq.com>
AuthorDate: Sun Aug 29 18:49:23 2021 +0800

    add example demo (#133)
---
 docs/zh-cn/example.md    | 131 +++++++++++++++++++++++++++++++++++++++++++++++
 img/create-account.png   | Bin 0 -> 52617 bytes
 img/create-business.png  | Bin 0 -> 34557 bytes
 img/create-stream.png    | Bin 0 -> 33998 bytes
 img/data-information.png | Bin 0 -> 24359 bytes
 img/hive-config.png      | Bin 0 -> 36665 bytes
 site_config/docs.js      |   4 ++
 7 files changed, 135 insertions(+)

diff --git a/docs/zh-cn/example.md b/docs/zh-cn/example.md
new file mode 100644
index 0000000..332cdab
--- /dev/null
+++ b/docs/zh-cn/example.md
@@ -0,0 +1,131 @@
+---
+title: 入库 Hive 示例 - Apache InLong
+---
+
+本节用一个简单的示例,帮助您使用 Docker 快速体验 InLong 的完整流程。
+
+## 前置要求
+* Git
+* Docker
+* Docker-Compose
+
+## 安装 Hive
+Hive 是运行的必备组件。如果您的机器上没有 Hive,这里推荐使用 Docker 进行快速安装,详情可见 [这里](https://github.com/big-data-europe/docker-hive)。
+
+> 注意,我们需要在 namenode 中添加一个端口映射 `8020:8020`,因为它是 HDFS DefaultFS 的端口。
+
+## 安装 InLong
+我们提供了 InLong 的 Docker 镜像,帮助你快速部署所有组件。
+
+首先需要拉取 InLong 仓库
+```
+$ git clone https://github.com/apache/incubator-inlong.git
+```
+
+然后进入 `docker-compose` 目录下
+```
+$ cd ./docker/docker-compose
+```
+
+然后使用 `docker-compsoe` 命令安装 InLong 的相关组件
+```
+docker-compose up -d
+```
+
+我们可以使用 `docker-compose ps` 来观察所有容器的启动状况。待所有容器启动完毕后,InLong 即安装成功。
+
+## 新建账号
+首先我们访问 `http://localhost:80` 进入 InLong Manager 的主页,并输入账户名 `admin` 和 密码 `inlong` 进入管理员账户。
+
+然后进入 “系统管理” 界面,点击 “新建账号”,添加一个新的普通用户,这里我们以添加账户名 `test` 和 密码 `test` 为例。
+
+<img src="../../img/create-account.png" align="center" alt="Create Account"/>
+
+## 新建接入
+然后我们进入 “数据接入” 界面,点击右上角的 “新建接入”,新建一条接入,按下图所示填入业务信息
+
+<img src="../../img/create-business.png" align="center" alt="Create Business"/>
+
+然后点击下一步,按下图所示填入数据流信息
+
+<img src="../../img/create-stream.png" align="center" alt="Create Stream"/>
+
+注意其中消息来源选择“文件”,暂时不用新建数据源。
+
+然后我们在下面的“数据信息”一栏中填入以下信息
+
+<img src="../../img/date-information.png" align="center" alt="Data Information"/>
+
+然后在数据流向中选择 Hive,并点击 “添加”,添加 Hive 配置
+
+<img src="../../img/hive-config.png" align="center" alt="Hive Config"/>
+
+注意这里目标表无需提前创建,InLong Manager 会在接入通过之后自动为我们创建表。另外,请使用 “连接测试” 保证 InLong Manager 可以连接到你的 Hive。
+
+然后点击“提交审批”按钮,该接入就会创建成功,进入审批状态。
+
+## 审批接入
+进入“审批管理”界面,点击“我的审批”,将刚刚申请的接入通过。
+
+到此接入就已经创建完毕了,我们可以在 Hive 中看到相应的表已经被创建,并且在 TubeMQ 的管理界面中可以看到相应的 topic 已经创建成功。
+
+## 配置 agent
+然后我们使用 docker 进入 agent 容器内,创建相应的 agent 配置。
+```
+$ docker exec -it agent sh
+```
+
+然后我们新建 `.inlong` 文件夹,并创建以 `bid.local` 命名的文件,在其中填入 Dataproxy 有关配置。
+```
+$ mkdir .inlong
+$ cd .inlong
+$ touch b_test.local
+$ echo '{"cluster_id":1,"isInterVisit":1,"size":1,"address": [{"port":46801,"host":"dataproxy"}], "switch":0}' >> b_test.local
+```
+
+然后退出容器,使用 curl 向 agent 容器发送请求。
+```
+curl --location --request POST 'http://localhost:8008/config/job' \
+--header 'Content-Type: application/json' \
+--data '{
+"job": {
+"dir": {
+"path": "",
+"pattern": "/data/collect-data/test.log"
+},
+"trigger": "org.apache.inlong.agent.plugin.trigger.DirectoryTrigger",
+"id": 1,
+"thread": {
+"running": {
+"core": "4"
+}
+},
+"name": "fileAgentTest",
+"source": "org.apache.inlong.agent.plugin.sources.TextFileSource",
+"sink": "org.apache.inlong.agent.plugin.sinks.ProxySink",
+"channel": "org.apache.inlong.agent.plugin.channel.MemoryChannel"
+},
+"proxy": {
+"bid": "b_test",
+"tid": "test_stream"
+},
+"op": "add"
+}'
+```
+
+至此,agent 就配置完毕了。接下来我们可以新建 `./collect-data/test.log` ,并往里面添加内容,来触发 agent 向 dataproxy 发送数据了。
+
+```
+$ touch collect-data/test.log
+$ echo 'test,24' >> collect-data/test.log
+```
+
+然后观察 agent 和 dataproxy 的日志,可以看到相关数据已经成功发送。
+
+```
+$ docker logs agent
+$ docker logs dataproxy
+```
+
+
+
diff --git a/img/create-account.png b/img/create-account.png
new file mode 100644
index 0000000..be0ee68
Binary files /dev/null and b/img/create-account.png differ
diff --git a/img/create-business.png b/img/create-business.png
new file mode 100644
index 0000000..426b9cf
Binary files /dev/null and b/img/create-business.png differ
diff --git a/img/create-stream.png b/img/create-stream.png
new file mode 100644
index 0000000..9d7f8e9
Binary files /dev/null and b/img/create-stream.png differ
diff --git a/img/data-information.png b/img/data-information.png
new file mode 100644
index 0000000..8e6dc96
Binary files /dev/null and b/img/data-information.png differ
diff --git a/img/hive-config.png b/img/hive-config.png
new file mode 100644
index 0000000..ee7c86e
Binary files /dev/null and b/img/hive-config.png differ
diff --git a/site_config/docs.js b/site_config/docs.js
index 44e4e3b..50d033c 100644
--- a/site_config/docs.js
+++ b/site_config/docs.js
@@ -163,6 +163,10 @@ export default {
             title: '快速开始',
             link: '/zh-cn/docs/quick_start.html',
           },
+          {
+            title: '入库Hive示例',
+            link: '/zh-cn/docs/example.html'
+          }
         ],
       },
       {