-
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 #14 from ni-ze/main
feat(rocketmq) quick start is done.
- Loading branch information
Showing
18 changed files
with
302 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,94 @@ | ||
# Rocketmq Streams SQL | ||
# rsqldb | ||
|
||
Rocketmq Streams SQL 为 Rocketmq Streams 的开发提供了基于SQL的开发体验, 让基于消息队列的流式开发更加容易; | ||
rsqldb 为 Rocketmq Streams 的开发提供了基于SQL的开发体验, 让基于消息队列的流式开发更加容易; | ||
|
||
## Features | ||
|
||
* 采用标准的流式SQL规范,可以与其他的流计算框架如Flink完美兼容; | ||
* 兼容Flink自带的```udf```、```udaf```和```udtf```,除此之外,用户还可以通过实现相关接口来轻松扩展函数; | ||
|
||
|
||
如果您希望更详细的了解Rsqldb的相关内容, 请点击[这里](docs/SUMMARY.md) | ||
如果您希望更详细的了解rsqldb的相关内容, 请点击[这里](docs/SUMMARY.md) | ||
|
||
|
||
## Quickstart | ||
### 运行环境 | ||
- JDK 1.8及以上 | ||
- Maven 3.2及以上 | ||
|
||
### 下载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 | ||
chmod +x bin/startAll.sh;sh bin/startAll.sh | ||
``` | ||
|
||
### 配置sql文件 | ||
sendDataFromFile.sql中创建的任务,需要从本地文件指定位置读取数据,所以需要修改sendDataFromFile.sql中filePath变量的位置,修改为数据文件data.txt的绝对路径。 | ||
|
||
|
||
### 提交任务 | ||
执行路径依然在rsqldb解压目录下 | ||
```shell | ||
chmod +x client/clientExector.sh;sh client/clientExector.sh submitTask sendDataFromFile.sql | ||
``` | ||
|
||
|
||
### 启动任务 | ||
在rsqldb解压目录下执行,tail运行日志,为查看结果做准备。 | ||
```shell | ||
tail -f log/rsqldb-runner.log | ||
``` | ||
|
||
另开一个shell窗口,进入解压后的rsqldb目录,执行以下命令启动任务,1分钟后,查看日志输出,会将执行结果打印到日志中。 | ||
```shell | ||
sh client/clientExector.sh startTask | ||
``` | ||
|
||
### 查询任务 | ||
在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 | ||
chmod +x bin/startAll.sh;sh bin/startAll.sh | ||
``` | ||
- 提交任务 | ||
```shell | ||
chmod +x client/clientExector.sh;sh client/clientExector.sh submitTask rocketmq.sql | ||
``` | ||
- 查看输出 | ||
```shell | ||
tail -f log/rsqldb-runner.log | ||
``` | ||
- 另开一个窗口,启动任务 | ||
```shell | ||
sh client/clientExector.sh startTask | ||
``` | ||
- 向RocketMQ中生产数据:topic为rsqldb-source,与rocketmq.sql任务中的topic名称保持一致,向该topic写入data.txt文件中的数据。观察rsqldb-runner.log日志输出。 |
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 was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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
46 changes: 46 additions & 0 deletions
46
rsqldb-client/src/main/java/com/alibaba/rsqldb/client/QueryTask.java
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,46 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.rsqldb.client; | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import com.alibaba.rsqldb.client.http.HttpHelper; | ||
|
||
import static com.alibaba.rsqldb.client.constant.Constants.queryTask; | ||
|
||
public class QueryTask { | ||
public static void main(String[] args) throws Throwable { | ||
String result = HttpHelper.sendRequest(queryTask, "test", null); | ||
|
||
System.out.println(result); | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
rsqldb-client/src/main/java/com/alibaba/rsqldb/client/StopTask.java
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,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.rsqldb.client; | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import com.alibaba.rsqldb.client.http.HttpHelper; | ||
|
||
import static com.alibaba.rsqldb.client.constant.Constants.stopTask; | ||
|
||
public class StopTask { | ||
public static void main(String[] args) throws Throwable{ | ||
String result = HttpHelper.sendRequest(stopTask, "test", "test"); | ||
System.out.println(result); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
binDir=$(cd `dirname $0`;pwd) | ||
|
||
cd $binDir/.. | ||
homeDir=$(pwd) | ||
|
||
cd $binDir | ||
|
||
|
||
mainClass=() | ||
if [ "x$1" == "xsubmitTask" ]; then | ||
mainClass=com.alibaba.rsqldb.client.SubmitTask | ||
java -cp rsqldb-client-1.0.0-SNAPSHOT.jar ${mainClass} ${homeDir} $2 | ||
fi | ||
|
||
if [ "x$1" == "xstartTask" ]; then | ||
mainClass=com.alibaba.rsqldb.client.StartTask | ||
java -cp rsqldb-client-1.0.0-SNAPSHOT.jar ${mainClass} | ||
fi | ||
|
||
if [ "x$1" == "xqueryTask" ]; then | ||
mainClass=com.alibaba.rsqldb.client.QueryTask | ||
java -cp rsqldb-client-1.0.0-SNAPSHOT.jar ${mainClass} | ||
fi | ||
|
||
if [ "x$1" == "xstopTask" ]; then | ||
mainClass=com.alibaba.rsqldb.client.StopTask | ||
java -cp rsqldb-client-1.0.0-SNAPSHOT.jar ${mainClass} | ||
fi | ||
|
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,2 +1,4 @@ | ||
1,2,3,4,5,6,7,8,9 | ||
2,2,3,4,5,6,7,8,9 | ||
1,2,3,4 | ||
2,2,3,4 | ||
3,2,3,4 | ||
4,2,3,4 |
Oops, something went wrong.