From 31f63df1be19ca89b302c3ace30aae78afa7ea7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=B4=E7=AB=A0?= Date: Sun, 11 Sep 2022 16:11:56 +0800 Subject: [PATCH] docker-compose.sql 0.2 --- .gitignore | 4 ++-- docker-compose.yml | 4 ++-- rsqldb-disk/bin/startAll.sh | 2 +- rsqldb-disk/client/rocketmq.sql | 5 +++++ rsqldb-disk/client/sendDataFromFile.sql | 2 +- rsqldb-disk/conf/rsqldb.conf | 4 ++-- .../java/org/alibaba/rsqldb/runner/StreamRunner.java | 12 +++++++----- .../java/com/alibaba/rsqldb/server/Application.java | 4 ++-- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 254ef36..592dd66 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ target/ *.iml *.ipr *.gz -*/dipper.cs +*/rsqldb.cs ### NetBeans ### nbproject/private/ @@ -32,4 +32,4 @@ _book/ */dependency-reduced-pom.xml /rsqldb-disk/log/ -/rsqldb-disk/server/dipper.cs +/rsqldb-disk/server/rsqldb.cs diff --git a/docker-compose.yml b/docker-compose.yml index ef8b320..f3b1271 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: @@ -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: diff --git a/rsqldb-disk/bin/startAll.sh b/rsqldb-disk/bin/startAll.sh index 8f561d0..681d826 100644 --- a/rsqldb-disk/bin/startAll.sh +++ b/rsqldb-disk/bin/startAll.sh @@ -14,7 +14,7 @@ if [ ! -d log ]; then mkdir log fi -path=$homeDir/dipper.cs +path=$homeDir/rsqldb.cs sysOS=`uname -s` diff --git a/rsqldb-disk/client/rocketmq.sql b/rsqldb-disk/client/rocketmq.sql index f81241d..568f7e7 100644 --- a/rsqldb-disk/client/rocketmq.sql +++ b/rsqldb-disk/client/rocketmq.sql @@ -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 diff --git a/rsqldb-disk/client/sendDataFromFile.sql b/rsqldb-disk/client/sendDataFromFile.sql index b234d2b..7960a15 100644 --- a/rsqldb-disk/client/sendDataFromFile.sql +++ b/rsqldb-disk/client/sendDataFromFile.sql @@ -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' ); diff --git a/rsqldb-disk/conf/rsqldb.conf b/rsqldb-disk/conf/rsqldb.conf index 29cdc41..0f39c6b 100644 --- a/rsqldb-disk/conf/rsqldb.conf +++ b/rsqldb-disk/conf/rsqldb.conf @@ -9,5 +9,5 @@ dipper.configurable.service.type=file dipper.window.default.iterval.size.time=10 #client产生的流计算任务位置,目前需要填绝对路径,client生成后,runner从该位置读取流计算任务。配置形式为: -#filePathAndName=/Users/rsqldb/rsqldb-disk/server/dipper.cs -filePathAndName=/Users/nize/code/github/rsqldb/rsqldb-disk/server/dipper.cs +#filePathAndName=/Users/rsqldb/rsqldb-disk/server/rsqldb.cs +filePathAndName=/Users/nize/code/github/rsqldb/rsqldb-disk/server/rsqldb.cs diff --git a/rsqldb-runner/src/main/java/org/alibaba/rsqldb/runner/StreamRunner.java b/rsqldb-runner/src/main/java/org/alibaba/rsqldb/runner/StreamRunner.java index 08d7bb9..9a7eb95 100644 --- a/rsqldb-runner/src/main/java/org/alibaba/rsqldb/runner/StreamRunner.java +++ b/rsqldb-runner/src/main/java/org/alibaba/rsqldb/runner/StreamRunner.java @@ -53,17 +53,19 @@ public static void main(String[] args) throws Throwable { Properties properties = new Properties(); properties.load(in); - Map 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 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(";"); diff --git a/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java b/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java index f2a10b9..061d514 100644 --- a/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java +++ b/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java @@ -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"));