|
|
|
@ -15,13 +15,13 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
public class OpenGaussReplication {
|
|
|
|
|
|
|
|
|
|
public static String SOURCEURL = "jdbc:postgresql://10.10.14.209:5432/ccdjzswd_db";
|
|
|
|
|
public static String SOURCEURL = "jdbc:postgresql://10.10.14.61:15400/test_db";
|
|
|
|
|
public static String USER = "postgres";
|
|
|
|
|
public static String PASSWD = "DsideaL147258368";
|
|
|
|
|
public static String PASSWD = "DsideaL147258369";
|
|
|
|
|
|
|
|
|
|
public static String TOPIC = "pg_test";//定义主题
|
|
|
|
|
|
|
|
|
|
public static final String BROKERS_ADDRESS = "10.10.14.67:9094";
|
|
|
|
|
public static final String BROKERS_ADDRESS = "10.10.14.67:9092";
|
|
|
|
|
// public static final int REQUEST_REQUIRED_ACKS = 1;
|
|
|
|
|
// public static final String CLIENT_ID = "producer_test_id";
|
|
|
|
|
|
|
|
|
@ -48,8 +48,8 @@ public class OpenGaussReplication {
|
|
|
|
|
PgConnection conn = (PgConnection) DriverManager.getConnection(SOURCEURL, properties);
|
|
|
|
|
System.out.println("connection success!");
|
|
|
|
|
|
|
|
|
|
String slotName = "replication_slot";
|
|
|
|
|
String lsn = "22DBF70";
|
|
|
|
|
String slotName = "slot2";
|
|
|
|
|
String lsn = "403ED30";
|
|
|
|
|
|
|
|
|
|
LogSequenceNumber waitLSN = LogSequenceNumber.valueOf(lsn);
|
|
|
|
|
|
|
|
|
@ -58,14 +58,9 @@ public class OpenGaussReplication {
|
|
|
|
|
.replicationStream()
|
|
|
|
|
.logical()
|
|
|
|
|
.withSlotName(slotName)
|
|
|
|
|
.withSlotOption("include-xids", false)
|
|
|
|
|
.withSlotOption("skip-empty-xacts", true)
|
|
|
|
|
//.withSlotOption("include-xids", false)
|
|
|
|
|
// .withSlotOption("skip-empty-xacts", true)
|
|
|
|
|
.withStartPosition(waitLSN)
|
|
|
|
|
// .withSlotOption("parallel-decode-num", 10) //解;解码线程并发度
|
|
|
|
|
// .withSlotOption("white-table-list", "public.logic_test") //白名单列表
|
|
|
|
|
// .withSlotOption("standby-connection", true) //强制备机解码
|
|
|
|
|
// .withSlotOption("decode-style", "t") //解码格式
|
|
|
|
|
// .withSlotOption("sending-bacth", 1) //批量发送解码结果
|
|
|
|
|
.start();
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|