-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from ni-ze/quickStart
docker-compose quick start
- Loading branch information
Showing
13 changed files
with
247 additions
and
109 deletions.
There are no files selected for viewing
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
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
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,70 @@ | ||
--- | ||
version: '3.5' | ||
|
||
services: | ||
#Service for nameserver | ||
namesrv: | ||
image: apache/rocketmq:4.9.4 | ||
hostname: namesrv | ||
container_name: rmqnamesrv | ||
user: root | ||
networks: | ||
- rsqldb-quickstart | ||
cap_add: | ||
- SYS_PTRACE | ||
ports: | ||
- "9876:9876" | ||
command: sh mqnamesrv | ||
|
||
#Service for broker | ||
broker: | ||
image: apache/rocketmq:4.9.4 | ||
hostname: broker | ||
container_name: rmqbroker | ||
user: root | ||
networks: | ||
- rsqldb-quickstart | ||
cap_add: | ||
- SYS_PTRACE | ||
depends_on: | ||
- namesrv | ||
ports: | ||
- "10909:10909" | ||
- "10911:10911" | ||
- "10912:10912" | ||
environment: | ||
- NAMESRV_ADDR=namesrv:9876 | ||
command: sh mqbroker -c /home/rocketmq/rocketmq-4.9.4/conf/broker.conf | ||
|
||
rsqldb: | ||
image: unclerangoo/rsqldb:0.1 | ||
hostname: rsqldb | ||
container_name: rsqldb | ||
networks: | ||
- rsqldb-quickstart | ||
cap_add: | ||
- SYS_PTRACE | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- namesrv | ||
- broker | ||
environment: | ||
- NAMESRV_ADDR=namesrv:9876 | ||
|
||
rsqldb-client: | ||
image: unclerangoo/rsqldb-client:0.1 | ||
hostname: rsqldb-client | ||
container_name: rsqldb-client | ||
networks: | ||
- rsqldb-quickstart | ||
cap_add: | ||
- SYS_PTRACE | ||
depends_on: | ||
- rsqldb | ||
environment: | ||
- rsqldb=rsqldb:8080 | ||
- NAMESRV_ADDR=namesrv:9876 | ||
networks: | ||
rsqldb-quickstart: | ||
name: rsqldb-quickstart |
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,98 @@ | ||
## jar包启动 | ||
|
||
### 运行环境 | ||
- JDK 1.8及以上 | ||
- Maven 3.2及以上 | ||
|
||
### 在本地安装RocketMQ-Streams | ||
rsqldb依赖的RocketMQ-Streams版本为1.0.2-preview-SNAPSHOT(RocketMQ-Streams近期会做一次发版,发版之后省略该步骤)。 | ||
|
||
```shell | ||
git clone https://github.com/apache/rocketmq-streams.git | ||
#切换到main分支 | ||
mvn clean install -DskipTest -U | ||
``` | ||
|
||
### 下载rsqldb工程并本地构建 | ||
```xml | ||
git clone https://github.com/alibaba/rsqldb.git | ||
|
||
mvn clean package -DskipTest -U | ||
``` | ||
|
||
### 拷贝安装压缩包并解压 | ||
|
||
进入rsqldb-disk模块下,将rsqldb-distribution.tar.gz安装包拷贝到任意目录,并执行命令解压并进入解压目录: | ||
```xml | ||
tar -zxvf rsqldb-distribution.tar.gz;cd rsqldb | ||
``` | ||
|
||
|
||
### 启动rsqldb服务端 | ||
```shell | ||
sh bin/startAll.sh | ||
``` | ||
|
||
### 配置sql文件 | ||
sendDataFromFile.sql中创建的任务,需要从本地文件指定位置读取数据,所以需要修改sendDataFromFile.sql中filePath变量的位置,修改为数据文件data.txt的绝对路径。 | ||
|
||
|
||
### 提交任务 | ||
执行路径依然在rsqldb解压目录下 | ||
```shell | ||
sh client/clientExector.sh submitTask sendDataFromFile.sql | ||
``` | ||
sendDataFromFile.sql会从本地文件data.txt中读取数据,过滤出只含有field_1=1的数据,并将结果数据输出到日志中。 | ||
|
||
### 启动任务 | ||
在rsqldb解压目录下执行,tail运行日志,为查看结果做准备。 | ||
```shell | ||
tail -f log/rsqldb-runner.log | ||
``` | ||
|
||
另开一个shell窗口,进入解压后的rsqldb目录,执行以下命令启动任务,1分钟后,查看日志输出,会将执行结果打印到日志中。 | ||
```shell | ||
sh client/clientExector.sh startTask | ||
``` | ||
|
||
观察rsqldb-runner.log输出,输出结果中,只包含field_1=1的数据。 | ||
|
||
### 查询任务 | ||
在rsqldb解压目录下执行 | ||
```shell | ||
sh client/clientExector.sh queryTask | ||
``` | ||
返回已经提交的任务列表。 | ||
|
||
### 停止任务 | ||
在rsqldb解压目录下执行 | ||
```shell | ||
sh client/clientExector.sh stopTask | ||
``` | ||
|
||
### 从RocketMQ中读取数据并处理 | ||
上述示例为从本地文件data.txt中读取数据,更为常用的用法是从RocketMQ中读取数据处理,下面给出具体步骤: | ||
|
||
- 本地安装并启动RocketMQ,[安装文档](https://rocketmq.apache.org/docs/quick-start/) | ||
- 启动rsqldb服务端 | ||
```shell | ||
sh bin/startAll.sh | ||
``` | ||
- 提交任务 | ||
```shell | ||
sh client/clientExector.sh submitTask rocketmq.sql | ||
``` | ||
|
||
rocketmq.sql会从RocketMQ的rsqldb-source中读取数据,过滤出field_1=1的数据,并将结果输出到日志文件中。 | ||
|
||
- 查看输出 | ||
```shell | ||
tail -f log/rsqldb-runner.log | ||
``` | ||
- 另开一个窗口,启动任务 | ||
```shell | ||
sh client/clientExector.sh startTask | ||
``` | ||
- 向RocketMQ中生产数据:topic为rsqldb-source,与rocketmq.sql任务中的topic名称保持一致,向该topic写入data.txt文件中的数据。 | ||
|
||
- 观察输出,在输出结果中,只包含field_1=1的数据。 |
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,17 @@ | ||
## 工程本地运行 | ||
|
||
### 启动服务端 | ||
- 启动rsqldb-runner执行任务; | ||
|
||
主方法中添加home.dir参数,home.dir指向rsqldb-disk的绝对路径; | ||
- 启动rsqldb-server接收任务; | ||
|
||
主方法中添加home.dir参数,home.dir指向rsqldb-disk的绝对路径; | ||
### 启动客户端 | ||
- 提交任务 | ||
|
||
给SubmitTask类添加启动参数,参数一:rsqldb-disk的绝对路径;参数二:sql任务的文件名称,例如sendDataFromFile.sql; | ||
|
||
- 启动任务 | ||
|
||
直接运行StartTask类,无须参数; |
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
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
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
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
Oops, something went wrong.