Skip to content

Commit

Permalink
Merge pull request #41 from ni-ze/cloudP
Browse files Browse the repository at this point in the history
update docker-compose.yml
  • Loading branch information
ni-ze authored Sep 11, 2022
2 parents a2cd810 + 31f63df commit 129b95b
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 74 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ target/
*.iml
*.ipr
*.gz
*/dipper.cs
*/rsqldb.cs

### NetBeans ###
nbproject/private/
Expand All @@ -32,4 +32,4 @@ _book/

*/dependency-reduced-pom.xml
/rsqldb-disk/log/
/rsqldb-disk/server/dipper.cs
/rsqldb-disk/server/rsqldb.cs
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
command: sh mqbroker -c /home/rocketmq/rocketmq-4.9.4/conf/broker.conf

rsqldb:
image: unclerangoo/rsqldb:0.1
image: unclerangoo/rsqldb:0.2
hostname: rsqldb
container_name: rsqldb
networks:
Expand All @@ -53,7 +53,7 @@ services:
- NAMESRV_ADDR=namesrv:9876

rsqldb-client:
image: unclerangoo/rsqldb-client:0.1
image: unclerangoo/rsqldb-client:0.2
hostname: rsqldb-client
container_name: rsqldb-client
networks:
Expand Down
17 changes: 3 additions & 14 deletions docs/other_quick_start/本地jar包启动.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ mvn clean package -DskipTest -U
tar -zxvf rsqldb-distribution.tar.gz;cd rsqldb
```

### 配置rsqldb服务端
- 打开conf目录下rsqldb.conf文件;
- 修改filePathAndName,filePathAndName为保存流处理任务的文件,可以修改为rsqldb解压路径,加上文件名称;

### 启动rsqldb服务端
```shell
sh bin/startAll.sh
```

### 配置sql文件
sendDataFromFile.sql中创建的任务,需要从本地文件指定位置读取数据,所以需要修改sendDataFromFile.sql中filePath变量的位置,修改为数据文件data.txt的绝对路径。

### 配置sql
执行sql以sendDataFromFile.sql为例,该sql任务的数据处理流程为:从本地data.txt文件中读取数据(data.txt文件在client目录中),过滤出field_1=1的数据,并打印在日志中;为了顺利执行,需要做以下配置:
- client/sendDataFromFile.sql中修改filePath指向data.txt的全路径,例如为:/home/rsqldb/client/data.txt;

### 提交任务
执行路径依然在rsqldb解压目录下
Expand Down Expand Up @@ -78,13 +74,6 @@ sh client/clientExector.sh stopTask

- 本地安装并启动RocketMQ,[安装文档](https://rocketmq.apache.org/docs/quick-start/)

- 配置rsqldb服务端
```xml
打开conf目录下rsqldb.conf文件;
修改filePathAndName,filePathAndName为保存流处理任务的文件,可以修改为rsqldb解压路径,加上文件名称;
如果有必要,可以修改NAMESRV_ADDR,执行自己配置的namesrv地址;
```

- 启动rsqldb服务端
```shell
sh bin/startAll.sh
Expand Down
11 changes: 11 additions & 0 deletions rsqldb-disk/bin/startAll.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

binDir=$(cd `dirname $0`;pwd)
echo "binDir=$binDir"
Expand All @@ -13,6 +14,16 @@ if [ ! -d log ]; then
mkdir log
fi

path=$homeDir/rsqldb.cs

sysOS=`uname -s`

if [ $sysOS == "Darwin" ];then
sed -i '' 's#^filePathAndName.*$#filePathAndName='$path'#g' $homeDir/conf/rsqldb.conf;
elif [ $sysOS == "Linux" ];then
sed -i 's#^filePathAndName.*$#filePathAndName='$path'#g' $homeDir/conf/rsqldb.conf;
fi

cd $binDir

chmod +x startTaskExecutor.sh
Expand Down
5 changes: 5 additions & 0 deletions rsqldb-disk/client/rocketmq.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ CREATE TABLE `task_sink_2`
) WITH (
type = 'print'
);
-- 写入rocketmq中
-- type = 'rocketmq',
-- topic = 'rsqldb-sink',
-- groupName = 'rsqldb-group',
-- namesrvAddr = '127.0.0.1:9876'

insert into task_sink_2
select field_1
Expand Down
2 changes: 1 addition & 1 deletion rsqldb-disk/client/sendDataFromFile.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE TABLE `test_source`
) WITH (
type = 'file',
-- 需要根据自身填写data.txt的绝对路径
filePath = '',
filePath = '/Users/nize/code/github/rsqldb/rsqldb-disk/client/data.txt',
isJsonData = 'true',
msgIsJsonArray = 'false'
);
Expand Down
51 changes: 3 additions & 48 deletions rsqldb-disk/conf/rsqldb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,10 @@ namespace=test
## checkpoint存储配置,可以是memory, DB 或者file, 除了checkpoint外, 任务序列化的内容也会被缓存在该存储
dipper.configurable.service.type=file

rsldb.custom.function.jar.path=
## 当checkpoint为DB时
#dipper.rds.jdbc.type=mysql
#dipper.rds.jdbc.url=jdbc:mysql://host:port/database?serverTimezone=Asia/Shanghai
#dipper.rds.jdbc.username=
#dipper.rds.jdbc.password=
#dipper.rds.jdbc.driver=com.mysql.jdbc.Driver
#dipper.rds.table.name=dipper_configure
## 任务从存储反序列化的频次
#dipper.configurable.polling.time=60
#pipeline.qps.print=true
#homologous.expression.cache.size=100000
#homologous.pre.fingerprint.cache.size=100000
#homologous.optimization.switch=true
## 监控日志的相关配置
# dipper.monitor.output.level=INFO #日志等级,有三种INFO,SLOW,ERROR
#dipper.monitor.slow.timeout=60000
# dipper.monitor.logs.dir=./logs #日志目录
## 窗口配置
#group by 时窗口大小,单位s,sql中不配置或者这里不指定的话默认600s
dipper.window.default.iterval.size.time=10
# dipper.window.join.default.interval.size.time= #join的默认窗口大小
# dipper.window.join.default.retain.window.count= #需要保留几个窗口
# dipper.window.default.fire.delay.second= #窗口延迟多长时间触发
# dipper.window.default.interval.size.time= #统计默认的窗口大小,单位是分钟。默认是滚动窗口,大小是1个小时
# dipper.window.default.time.unit.adjust= #统计默认的窗口大小,单位是分钟。默认是滚动窗口,大小是1个小时
# dipper.window.over.default.interval.size.time= #over partition窗口的默认时间
## 窗口shuffle配置
window.shuffle.channel.type=memory
# window.shuffle.channel.type=rocketmq #shuffle使用的数据存储类型
# window.shuffle.channel.topic= #根据type的配置,有不同的配置, topic是指用于shuffle的rocketmq的topic;
# window.shuffle.channel.tags= #根据type的配置,有不同的配置, tags是指用于shuffle的rocketmq的tags;
# window.shuffle.channel.group= #根据type的配置,有不同的配置, group是指用于shuffle的rocketmq的group;
# window.system.message.channel.owner=#如果能做消息过滤,只过滤本window的消息,可以配置这个属性,如rocketmq的tags.不支持的会做客户端过滤
## 自定义配置文件路径, 默认查找classpath下的配置文件,或者在jar包所在目录的资源文件

#client产生的流计算任务位置,目前需要填绝对路径,client生成后,runner从该位置读取流计算任务。
filePathAndName=/Users/nize/code/github/rsqldb/rsqldb-disk/server/dipper.cs

## 把所有的输出重新定向,当测试时,不需要把结果写入正式的输出时,可以使用,默认会打印,如果需要输出到其他存储,可以配置#
# out.mock.switch=false
## mock的类型,可以是print,metaq和sls。下面是具体类型的配置
# out.mock.type=print
# out.mock.metaq.topic=
# out.mock.metaq.tag=
# out.mock.metaq.consumerGroup=
# out.mock.sls.endPoint=
# out.mock.sls.project=
# out.mock.sls.logstore=
# out.mock.sls.accessKey=
# out.mock.sls.accessId=
# out.mock.sls.group=
#client产生的流计算任务位置,目前需要填绝对路径,client生成后,runner从该位置读取流计算任务。配置形式为:
#filePathAndName=/Users/rsqldb/rsqldb-disk/server/rsqldb.cs
filePathAndName=/Users/nize/code/github/rsqldb/rsqldb-disk/server/rsqldb.cs
5 changes: 5 additions & 0 deletions rsqldb-disk/distribution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ limitations under the License.
<directory>conf</directory>
<outputDirectory>/conf</outputDirectory>
</fileSet>
<fileSet>
<fileMode>0775</fileMode>
<directory>customFunction</directory>
<outputDirectory>/customFunction</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@ public static void main(String[] args) throws Throwable {
Properties properties = new Properties();
properties.load(in);

Map<String, String> env = System.getenv();
String namesrvAddrEnv = env.get(MixAll.NAMESRV_ADDR_ENV);
if (namesrvAddrEnv != null) {
properties.put(MixAll.NAMESRV_ADDR_ENV, namesrvAddrEnv);
}

String filePathAndName = properties.getProperty("filePathAndName");
if (StringUtils.isEmpty(filePathAndName)) {
throw new IllegalArgumentException("filePathAndName is required.");
}

//使用env中配置的namesrv地址覆盖rsqldb.conf中的;
Map<String, String> env = System.getenv();
String namesrvAddrEnv = env.get(MixAll.NAMESRV_ADDR_ENV);
if (namesrvAddrEnv != null) {
properties.put(MixAll.NAMESRV_ADDR_ENV, namesrvAddrEnv);
}

String namesrvAddrs = properties.getProperty(MixAll.NAMESRV_ADDR_ENV);

String[] temp = namesrvAddrs.trim().split(";");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public static void main(String[] args) {
if (!file.exists()) {
boolean result = file.mkdirs();
if (!result) {
throw new RuntimeException("create dipper.cs path error");
throw new RuntimeException("create rsqldb.cs path error");
}
}

System.setProperty("cs.dir", dipperCsParentPath + "/dipper.cs");
System.setProperty("cs.dir", dipperCsParentPath + "/rsqldb.cs");

System.out.println(System.getProperty("cs.dir"));

Expand Down

0 comments on commit 129b95b

Please sign in to comment.