-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE #673] update eventmesh-runtime-quickstart-with-docker.md en & …
- Loading branch information
Showing
2 changed files
with
271 additions
and
41 deletions.
There are no files selected for viewing
153 changes: 153 additions & 0 deletions
153
docs/cn/instructions/eventmesh-runtime-quickstart-with-docker.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
# 使用 Docker 快速入门 EventMesh | ||
|
||
本篇快速入门将详细介绍使用 docker 部署 EventMesh,以 RocketMQ 作为对接的中间件。 | ||
|
||
可选语言: [英文版本](../../en/instructions/eventmesh-runtime-quickstart-with-docker.md),[中文版本](eventmesh-runtime-quickstart-with-docker.md)。 | ||
|
||
## 前提 | ||
1. 建议使用64位的 linux 系统。 | ||
2. 请预先安装 Docker Engine。 Docker 的安装过程可以参考 [docker 官方文档](https://docs.docker.com/engine/install/). | ||
3. 建议掌握基础的 docker 概念和命令行,例如注册中心、挂载等等。不过这不是必须的,因为所有使用到的命令行都列出来了。 | ||
4. [RocketMQ 成功的在运行](https://rocketmq.apache.org/docs/quick-start/) 并且可以使用 ip 地址访问到。 | ||
|
||
## 获取 EventMesh 镜像 | ||
首先,你可以打开一个命令行,并且使用下面的 ```pull``` 命令从 [Docker Hub](https://registry.hub.docker.com/r/eventmesh/eventmesh/tags) 中下载[最新发布的 EventMesh](https://eventmesh.apache.org/events/release-notes/v1.3.0/) 。 | ||
```shell | ||
sudo docker pull eventmesh/eventmesh:v1.3.0 | ||
``` | ||
在下载过程中和下载结束后,你可以看到命令行中显示以下的文字: | ||
```shell | ||
ubuntu@VM-16-4-ubuntu:~$ sudo docker pull eventmesh/eventmesh:v1.3.0 | ||
v1.3.0: Pulling from eventmesh/eventmesh | ||
2d473b07cdd5: Downloading [======> ] 9.649MB/76.1MB | ||
2b97b2e51c1a: Pulling fs layer | ||
ccef593d4fe7: Pulling fs layer | ||
70beb7ae51cd: Waiting | ||
0a2cf32321af: Waiting | ||
5d764ea8950d: Waiting | ||
71d02dcd996d: Waiting | ||
v1.3.0: Pulling from eventmesh/eventmesh | ||
2d473b07cdd5: Pull complete | ||
2b97b2e51c1a: Pull complete | ||
ccef593d4fe7: Pull complete | ||
70beb7ae51cd: Pull complete | ||
0a2cf32321af: Pull complete | ||
5d764ea8950d: Pull complete | ||
71d02dcd996d: Pull complete | ||
Digest: sha256:267a93a761e999790f8bd132b09541f0ffab551e8618097a4adce8e3e66bbe4e | ||
Status: Downloaded newer image for eventmesh/eventmesh:v1.3.0 | ||
docker.io/eventmesh/eventmesh:v1.3.0 | ||
``` | ||
接下来,你可以使用以下命令列出并查看本地已有的镜像。 | ||
```shell | ||
sudo docker images | ||
``` | ||
终端中会显示如下所示的镜像信息,可以发现 EventMesh 镜像已经成功下载到本地了。 | ||
```shell | ||
ubuntu@VM-16-4-ubuntu:~$ sudo docker images | ||
REPOSITORY TAG IMAGE ID CREATED SIZE | ||
eventmesh/eventmesh v1.3.0 da0008c1d03b 7 days ago 922MB | ||
``` | ||
|
||
## 准备配置文件 | ||
在根据 EventMesh 镜像运行对应容器之前,你需要创建一些配置文件。 | ||
|
||
本篇入门指导使用 RocketMQ 作为对接的中间件,所以需要两个配置文件,分别是:```eventMesh.properties``` 和 ```rocketmq-client.properties```。 | ||
|
||
首先,你需要使用下面的命令创建这两个文件。 | ||
```shell | ||
sudo mkdir -p /data/eventmesh/rocketmq/conf | ||
cd /data/eventmesh/rocketmq/conf | ||
sudo touch eventmesh.properties | ||
sudo touch rocketmq-client.properties | ||
``` | ||
|
||
### 配置 eventMesh.properties | ||
|
||
这个配置文件中包含 EventMesh 运行时环境和集成进来的其他插件所需的参数。 | ||
|
||
使用下面的 ```vi``` 命令编辑 ```eventmesh.properties```。 | ||
```shell | ||
sudo vi eventmesh.properties | ||
``` | ||
在快速入门的阶段,你可以直接将 GitHub 仓库中的对应配置文件中的内容复制过来,链接为:https://github.com/apache/incubator-eventmesh/blob/1.3.0/eventmesh-runtime/conf/eventmesh.properties 。 | ||
|
||
其中的一些默认属性键值对如下所示: | ||
|
||
| 属性 | 默认值 | 备注 | | ||
|----------------------------|-------|----------------------------| | ||
| eventMesh.server.http.port | 10105 | EventMesh http server port | | ||
| eventMesh.server.tcp.port | 10000 | EventMesh tcp server port | | ||
|
||
|
||
|
||
### 配置 rocketmq-client.properties | ||
|
||
这个配置文件中包含 RocketMQ nameserver 的一些信息。 | ||
|
||
使用下面的 ```vi``` 命令编辑 ```rocketmq-client.properties```。 | ||
```shell | ||
sudo vi rocketmq-client.properties | ||
``` | ||
|
||
在快速入门的阶段,你可以直接将 GitHub 仓库中的对应配置文件中的内容复制过来,链接为:https://github.com/apache/incubator-eventmesh/blob/1.3.0/eventmesh-runtime/conf/rocketmq-client.properties 。但要记得将默认值改为一个实际正在运行的 nameserver 地址。 | ||
|
||
默认的键值对示例如下所示: | ||
|
||
| 属性 | 默认值 | 备注 | | ||
|---------------------------------------|-------------------------------|----------------------------------| | ||
| eventMesh.server.rocketmq.namesrvAddr | 127.0.0.1:9876;127.0.0.1:9876 | RocketMQ namesrv default address | | ||
|
||
|
||
## 运行 EventMesh | ||
现在你就可以开始根据下载好的 EventMesh 镜像运行容器了。 | ||
|
||
使用到的命令是 ```docker run```,有以下两点内容需要格外注意。 | ||
1. 绑定容器端口和宿主机端口:使用 ```docker run``` 的 ```-p``` 选项。 | ||
2. 将宿主机中的两份配置文件挂在到容器中:使用 ```docker run``` 的 ```-v``` 选项。 | ||
|
||
综合一下,对应的启动命令为: | ||
```shell | ||
sudo docker run -d \ | ||
> -p 10000:10000 -p 10105:10105 \ | ||
> -v /data/eventmesh/rocketmq/conf/eventMesh.properties:/data/app/eventmesh/conf/eventMesh.properties \ | ||
> -v /data/eventmesh/rocketmq/conf/rocketmq-client.properties:/data/app/eventmesh/conf/rocketmq-client.properties \ | ||
> eventmesh/eventmesh:v1.3.0 | ||
``` | ||
如果运行命令之后看到新输出一行字符串,那么运行 EventMesh 镜像的容器就启动成功了。 | ||
|
||
接下来,你可以使用下面的命令查看容器的状态。 | ||
```shell | ||
sudo docker ps | ||
``` | ||
|
||
如果成功的话,你会看到终端打印出了如下所示容器的信息,其中就有运行 EventMesh 镜像的容器。 | ||
```shell | ||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
d1e1a335d4a9 eventmesh/eventmesh:v1.3.0 "/bin/sh -c 'sh star…" About a minute ago Up About a minute 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:10105->10105/tcp, :::10105->10105/tcp focused_bartik | ||
``` | ||
从这个信息中可以看出,```container id``` 是 ```d1e1a335d4a9```,随机 ```name``` 是 ```focused_bartik```,它们都可以用来唯一标识这个容器。**注意**:在你的电脑中,它们的值可能跟这里的不同。 | ||
|
||
## 管理 EventMesh 容器 | ||
在成功的运行了 EventMesh 容器后,你可以通过进入容器、查看日志、删除容器等方式管理容器。 | ||
|
||
**进入容器** 命令示例: | ||
```shell | ||
sudo docker exec -it [your container id or name] /bin/bash | ||
``` | ||
|
||
在容器中 **查看日志** 命令示例: | ||
```shell | ||
cd ../logs | ||
tail -f eventmesh.out | ||
``` | ||
|
||
**删除容器** 命令示例: | ||
```shell | ||
sudo docker rm -f [your container id or name] | ||
``` | ||
|
||
## 探索更多 | ||
既然 EventMesh 已经通过容器运行了,现在你可以参考 [```eventmesh-examples``` 模块](https://github.com/apache/incubator-eventmesh/tree/master/eventmesh-examples) 编写并测试自己的代码了。 | ||
|
||
希望你享受这个过程并获得更多收获! |
159 changes: 118 additions & 41 deletions
159
docs/en/instructions/eventmesh-runtime-quickstart-with-docker.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,151 @@ | ||
# Quick start Instruction | ||
# Quick Start Instruction | ||
This quick start instruction is a detailed guide of setting up EventMesh via docker. It takes RocketMQ as connector for example. | ||
|
||
## 3 Run with Docker | ||
Alternative languages: [English version](eventmesh-runtime-quickstart-with-docker.md), [Chinese version](../../cn/instructions/eventmesh-runtime-quickstart-with-docker.md). | ||
|
||
### 3.1 Pull | ||
## Prerequisites | ||
1. 64bit Linux is recommended. | ||
2. Docker Engine is assumed installed. The installation procedure could be found on [docker docs](https://docs.docker.com/engine/install/). | ||
3. Basic [docker concepts and commands](https://docs.docker.com/get-started/) are highly recommended acquiring first, including registry, volume, etc. However, it's not a necessity for going through this instruction because every commands are listed. | ||
4. [RocketMQ is running successfully](https://rocketmq.apache.org/docs/quick-start/) and could be routed to through IP address. | ||
|
||
execute `docker pull eventmesh/eventmesh-rocketmq:v1.3.0` , you will get EventMesh image like below | ||
## Get EventMesh Image | ||
First, you could open a terminal and use the following ```pull``` command to download [latest EventMesh](https://eventmesh.apache.org/events/release-notes/v1.3.0/) from [Docker Hub - the default docker registry](https://registry.hub.docker.com/r/eventmesh/eventmesh/tags). | ||
```shell | ||
sudo docker pull eventmesh/eventmesh:v1.3.0 | ||
``` | ||
During and After downloading, the terminal will show the status such as: | ||
```shell | ||
ubuntu@VM-16-4-ubuntu:~$ sudo docker pull eventmesh/eventmesh:v1.3.0 | ||
v1.3.0: Pulling from eventmesh/eventmesh | ||
2d473b07cdd5: Downloading [======> ] 9.649MB/76.1MB | ||
2b97b2e51c1a: Pulling fs layer | ||
ccef593d4fe7: Pulling fs layer | ||
70beb7ae51cd: Waiting | ||
0a2cf32321af: Waiting | ||
5d764ea8950d: Waiting | ||
71d02dcd996d: Waiting | ||
v1.3.0: Pulling from eventmesh/eventmesh | ||
2d473b07cdd5: Pull complete | ||
2b97b2e51c1a: Pull complete | ||
ccef593d4fe7: Pull complete | ||
70beb7ae51cd: Pull complete | ||
0a2cf32321af: Pull complete | ||
5d764ea8950d: Pull complete | ||
71d02dcd996d: Pull complete | ||
Digest: sha256:267a93a761e999790f8bd132b09541f0ffab551e8618097a4adce8e3e66bbe4e | ||
Status: Downloaded newer image for eventmesh/eventmesh:v1.3.0 | ||
docker.io/eventmesh/eventmesh:v1.3.0 | ||
``` | ||
Next, you could list and check local images on your machine using command: | ||
```shell | ||
sudo docker images | ||
``` | ||
And, the terminal will print all local images such as the following content. It could be found that EventMesh image has been successfully downloaded. | ||
```shell | ||
ubuntu@VM-16-4-ubuntu:~$ sudo docker images | ||
REPOSITORY TAG IMAGE ID CREATED SIZE | ||
eventmesh/eventmesh v1.3.0 da0008c1d03b 7 days ago 922MB | ||
``` | ||
|
||
![image-20210309155255510](../../images/docker/docker-image.png) | ||
## Prepare Configuration Files | ||
Before running the EventMesh container from downloaded image, you need to configure some files. | ||
|
||
### 3.2 Configuration | ||
Here this instruction takes RocketMQ as connector for example, so that two configuration files should be created: ```eventMesh.properties``` and ```rocketmq-client.properties```. | ||
|
||
> **prerequisite** : may be you need download the source code from git first and use the contents of these files(eventMesh.properties and rocketmq-client.properties) as a reference for the following actions. | ||
First, you may need to create such files, using following commands: | ||
```shell | ||
sudo mkdir -p /data/eventmesh/rocketmq/conf | ||
cd /data/eventmesh/rocketmq/conf | ||
sudo touch eventmesh.properties | ||
sudo touch rocketmq-client.properties | ||
``` | ||
|
||
**3.2.1 Files to configure** | ||
### eventMesh.properties | ||
|
||
Before run the container you should configure some files. | ||
It contains properties of EventMesh runtime env and integrated plugins. | ||
|
||
**eventMesh.properties** | ||
Use ```vi``` command to edit ```eventmesh.properties```: | ||
```shell | ||
sudo vi eventmesh.properties | ||
``` | ||
In the quick start step, you could directly copy content in https://github.com/apache/incubator-eventmesh/blob/1.3.0/eventmesh-runtime/conf/eventmesh.properties . | ||
|
||
Some default key-values are listed below: | ||
|
||
| Configuration Key | Default Value | Remarks | | ||
| ---------------------- | ------------- | -------------------------- | | ||
| Configuration Key | Default Value | Remarks | | ||
|----------------------------|---------------|----------------------------| | ||
| eventMesh.server.http.port | 10105 | EventMesh http server port | | ||
| eventMesh.server.tcp.port | 10000 | EventMesh tcp server port | | ||
|
||
**rocketmq-client.properties** | ||
|
||
| Configuration Key | Default Value | Remarks | | ||
| --------------------------------- | ----------------------------- | -------------------------------- | | ||
| eventMesh.server.rocketmq.namesrvAddr | 127.0.0.1:9876;127.0.0.1:9876 | RocketMQ namesrv default address | | ||
|
||
After pull the EventMesh image to your host machine, you can execute command below to configure **eventMesh.properties** | ||
and **rocketmq-client.properties** | ||
### rocketmq-client.properties | ||
|
||
**3.2.2 Create Files** | ||
It contains properties of running RocketMQ nameserver. | ||
|
||
Use ```vi``` command to edit ```rocketmq-client.properties```: | ||
```shell | ||
mkdir -p /data/eventmesh/rocketmq/conf | ||
cd /data/eventmesh/rocketmq/conf | ||
vi eventMesh.properties | ||
vi rocketmq-client.properties | ||
sudo vi rocketmq-client.properties | ||
``` | ||
In the quick start step, you could refer to https://github.com/apache/incubator-eventmesh/blob/1.3.0/eventmesh-runtime/conf/rocketmq-client.properties , and change the value to a running nameserver address. | ||
|
||
The default key-value is listed below: | ||
|
||
The contents of these files can reference | ||
from [eventMesh.properties](https://github.com/WeBankFinTech/EventMesh/blob/develop/eventmesh-runtime/conf/eventMesh.properties) | ||
and [rocketmq-client.properties](https://github.com/WeBankFinTech/EventMesh/blob/develop/eventmesh-runtime/conf/rocketmq-client.properties) | ||
| Configuration Key | Default Value | Remarks | | ||
|---------------------------------------|-------------------------------|----------------------------------| | ||
| eventMesh.server.rocketmq.namesrvAddr | 127.0.0.1:9876;127.0.0.1:9876 | RocketMQ namesrv default address | | ||
|
||
### 3.3 Run | ||
|
||
**3.3.1 run** | ||
## Make EventMesh Run | ||
Now you are at the step of running an EventMesh container from downloaded docker image. | ||
|
||
execute command below to run container | ||
The main command is ```docker run```, and two things need to be noted. | ||
1. binding the container port with host machine port: use ```-p``` option of ```docker run```. | ||
2. mount the configuration files with host machine files: use ```-v``` option of ```docker run```. | ||
|
||
So that the command for running EventMesh is: | ||
```shell | ||
sudo docker run -d \ | ||
> -p 10000:10000 -p 10105:10105 \ | ||
> -v /data/eventmesh/rocketmq/conf/eventMesh.properties:/data/app/eventmesh/conf/eventMesh.properties \ | ||
> -v /data/eventmesh/rocketmq/conf/rocketmq-client.properties:/data/app/eventmesh/conf/rocketmq-client.properties \ | ||
> eventmesh/eventmesh:v1.3.0 | ||
``` | ||
docker run -d -p 10000:10000 -p 10105:10105 -v /data/eventmesh/rocketmq/conf/eventMesh.properties:/data/app/eventmesh/conf/eventMesh.properties -v /data/eventmesh/rocketmq/conf/rocketmq-client.properties:/data/app/eventmesh/conf/rocketmq-client.properties docker.io/eventmesh/eventmesh-rocketmq:v1.3.0 | ||
``` | ||
After you executing it and seeing a string below it, the container is running successfully. | ||
|
||
> -p : binding the container port with host machine port | ||
> | ||
> -v : mount the container configuration files with host machine files | ||
Next, you could use below command to check the status of the EventMesh container: | ||
```shell | ||
sudo docker ps | ||
``` | ||
|
||
**3.3.2 check container** | ||
Successfully, you could see the terminal presenting container status such as: | ||
```shell | ||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
d1e1a335d4a9 eventmesh/eventmesh:v1.3.0 "/bin/sh -c 'sh star…" About a minute ago Up About a minute 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:10105->10105/tcp, :::10105->10105/tcp focused_bartik | ||
``` | ||
It tells you that ```container id``` is ```d1e1a335d4a9``` and random ```name``` is ```focused_bartik```. They are the identifier to this container when managing it. Note that they may be different in your machine. | ||
|
||
execute `docker ps` to check the container health | ||
## Manage EventMesh Container | ||
After correctly running EventMesh container, you could manage such container by entering container, checking logs, remove container, and so on. | ||
|
||
![image-docker-ps](../../images/docker/docker-ps.png) | ||
**enter container** command example: | ||
```shell | ||
sudo docker exec -it [your container id or name] /bin/bash | ||
``` | ||
|
||
execute `docker logs [container id]` you will get following result: | ||
**checking logs** command example inside container: | ||
```shell | ||
cd ../logs | ||
tail -f eventmesh.out | ||
``` | ||
|
||
![image-docker-logs](../../images/docker/docker-logs.png) | ||
**remove container** command example: | ||
```shell | ||
sudo docker rm -f [your container id or name] | ||
``` | ||
|
||
execute `docker exec -it [container id] /bin/bash` you will go into the container and see the details: | ||
## Explore More | ||
Since EventMesh is running, now you can write your own client code referring [```eventmesh-examples```](https://github.com/apache/incubator-eventmesh/tree/master/eventmesh-examples). | ||
|
||
![image-docker-exec](../../images/docker/docker-exec.png) | ||
Hope you enjoy and explore more on EventMesh! |