forked from iisquare/fs-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
2,302 additions
and
587 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
**/*.log | ||
**/__pycache__ | ||
**/*.zip | ||
!.gitkeep | ||
|
||
/docker/.env | ||
/docker/runtime | ||
|
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 was deleted.
Oops, something went wrong.
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
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,8 @@ | ||
# docker run -i --rm postgres cat /usr/share/postgresql/postgresql.conf.sample | ||
|
||
listen_addresses = '*' | ||
|
||
wal_level = logical | ||
|
||
archive_mode = on | ||
archive_command = 'cp %p /var/lib/postgresql/archive/%f' |
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 |
---|---|---|
|
@@ -10,3 +10,5 @@ | |
/web/xlab/libs/x86/ | ||
/web/xlab/libs/*.jar | ||
/web/file/uploads | ||
|
||
/ext/flink/checkpoints/**/ |
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,4 @@ | ||
|
||
subprojects { | ||
archivesBaseName = rootProject.name + '-ext-' + name | ||
} |
File renamed without changes.
Empty file.
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,4 @@ | ||
jobmanager.rpc.address: 127.0.0.1 | ||
jobmanager.rpc.port: 6123 | ||
rest.address: 127.0.0.1 | ||
rest.port: 8081 |
2 changes: 1 addition & 1 deletion
2
...quare/fs/plugins/flink/TestTransform.java → .../iisquare/fs/ext/flink/TestTransform.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
24 changes: 24 additions & 0 deletions
24
java/ext/flink/src/main/java/com/iisquare/fs/ext/flink/cli/CDCSubmitter.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,24 @@ | ||
package com.iisquare.fs.ext.flink.cli; | ||
|
||
import com.iisquare.fs.ext.flink.job.CDCJob; | ||
import com.iisquare.fs.ext.flink.util.CLIUtil; | ||
import org.apache.flink.client.cli.CliFrontend; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class CDCSubmitter { | ||
|
||
|
||
public static void main(String[] args) { | ||
System.out.println("Edit Environment FLINK_CONF_DIR=" + CLIUtil.path() + "conf"); | ||
List<String> params = Arrays.asList( | ||
"run", | ||
"-c", | ||
CDCJob.class.getName(), | ||
CLIUtil.path() + "build/libs/fs-project-ext-flink-0.0.1-SNAPSHOT.jar" | ||
); | ||
CliFrontend.main(params.toArray(new String[0])); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
java/ext/flink/src/main/java/com/iisquare/fs/ext/flink/job/CDCJob.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,37 @@ | ||
package com.iisquare.fs.ext.flink.job; | ||
|
||
import com.iisquare.fs.ext.flink.util.CLIUtil; | ||
import com.ververica.cdc.connectors.postgres.PostgreSQLSource; | ||
import com.ververica.cdc.debezium.JsonDebeziumDeserializationSchema; | ||
import org.apache.flink.runtime.state.hashmap.HashMapStateBackend; | ||
import org.apache.flink.streaming.api.CheckpointingMode; | ||
import org.apache.flink.streaming.api.datastream.DataStreamSource; | ||
import org.apache.flink.streaming.api.environment.CheckpointConfig; | ||
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; | ||
|
||
import java.util.Properties; | ||
|
||
public class CDCJob { | ||
|
||
public static void main(String[] args) throws Exception { | ||
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); | ||
env.enableCheckpointing(10000); | ||
env.setStateBackend(new HashMapStateBackend()); | ||
CheckpointConfig checkpoint = env.getCheckpointConfig(); | ||
checkpoint.setCheckpointStorage("file://" + CLIUtil.path() + "checkpoints"); | ||
checkpoint.setCheckpointingMode(CheckpointingMode.EXACTLY_ONCE); | ||
checkpoint.setExternalizedCheckpointCleanup(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION); | ||
PostgreSQLSource.Builder<String> builder = PostgreSQLSource.<String>builder() | ||
.hostname("127.0.0.1").username("postgres").password("admin888") | ||
.database("postgres").schemaList("public").tableList(".*") | ||
.decodingPluginName("pgoutput") // could not access file "decoderbufs": No such file or directory | ||
.deserializer(new JsonDebeziumDeserializationSchema()); | ||
builder.debeziumProperties(new Properties(){{ | ||
put("snapshot.mode", args[0]); | ||
}}); | ||
DataStreamSource<String> source = env.addSource(builder.build()); | ||
source.print(); | ||
env.execute("cdc-job"); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
java/ext/flink/src/main/java/com/iisquare/fs/ext/flink/util/CLIUtil.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,15 @@ | ||
package com.iisquare.fs.ext.flink.util; | ||
|
||
import com.iisquare.fs.ext.flink.job.CDCJob; | ||
|
||
public class CLIUtil { | ||
|
||
public static String path () { | ||
String path = CDCJob.class.getProtectionDomain().getCodeSource().getLocation().getPath(); | ||
int index = path.indexOf("/java/ext/flink/"); | ||
if (-1 == index) throw new RuntimeException("path error:" + path); | ||
path = path.substring(0, index) + "/java/ext/flink/"; | ||
return path; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...re/fs/plugins/flink/tester/DAGTester.java → ...square/fs/ext/flink/tester/DAGTester.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
29 changes: 29 additions & 0 deletions
29
java/ext/flink/src/test/java/com/iisquare/fs/ext/flink/tester/SubmitterTest.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,29 @@ | ||
package com.iisquare.fs.ext.flink.tester; | ||
|
||
import com.iisquare.fs.ext.flink.util.CLIUtil; | ||
import com.iisquare.fs.ext.flink.job.CDCJob; | ||
import org.apache.flink.client.cli.CliFrontend; | ||
import org.junit.Test; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class SubmitterTest { | ||
|
||
@Test | ||
public void cdcTest() { | ||
System.out.println("Environment FLINK_CONF_DIR=" + CLIUtil.path() + "conf"); | ||
List<String> params = Arrays.asList( | ||
"run", | ||
// "--fromSavepoint", | ||
// "D:\\htdocs\\fs-project-vip\\java\\ext\\flink\\checkpoints\\7eab743ad591b2bbd3f6046384874d7a\\chk-0", | ||
// "--allowNonRestoredState", // 当作业发生变更时,允许保留匹配节点 | ||
"-c", | ||
CDCJob.class.getName(), | ||
CLIUtil.path() + "build/libs/fs-project-ext-flink-0.0.1-SNAPSHOT.jar", | ||
"never" | ||
); | ||
CliFrontend.main(params.toArray(new String[0])); | ||
} | ||
|
||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...quare/fs/plugins/spark/TestTransform.java → .../iisquare/fs/ext/spark/TestTransform.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
Oops, something went wrong.