Release Notes
Product Announcements
# Download jdk8[root@VM-10-18-tencentos ~]# wget --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" \\https://download.oracle.com/java/18/archive/jdk-18.0.2_linux-x64_bin.tar.gz# Decompress the installation package[root@VM-10-18-tencentos ~]# tar -zxvf jdk-18.0.2_linux-x64_bin.tar.gz -C /usr/local/# Rename directory[root@VM-10-18-tencentos ~]# sudo mv /usr/local/jdk-18.0.2 /usr/local/jdk18
[root@VM-10-18-tencentos ~]# vim /etc/profile
export JAVA_HOME=/usr/local/jdk18export PATH=$JAVA_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib
[root@VM-10-18-tencentos ~]# source /etc/profile
[root@VM-10-18-tencentos ~]# java -versionjava version "18.0.2" 2022-07-19Java(TM) SE Runtime Environment (build 18.0.2+9-61)Java HotSpot(TM) 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing)
[root@VM-10-18-tencentos ~]# wget https://downloads.apache.org/kafka/3.7.2/kafka_2.13-3.7.2.tgz
# Create the installation directory for kafka[root@VM-10-18-tencentos ~]# mkdir -p /data/zookeeper# Decompress the kafka installation package[root@VM-10-18-tencentos ~]# tar -zxvf kafka_2.13-3.7.2.tgz -C /data/# Rename the decompressed directory[root@VM-10-18-tencentos ~]# cd /data/[root@VM-10-18-tencentos data]# mv kafka_2.13-3.7.2 kafka_dev
root@VM-10-18-tencentos data]# cd /data/kafka_dev/config[root@VM-10-18-tencentos config]# vim /data/kafka_dev/config/zookeeper.properties
dataDir =/data/zookeeper
[root@VM-10-18-tencentos config]# mkdir -p /data/kafka_dev/logs/
[root@VM-10-18-tencentos config]# vim connect-distributed.properties
listeners=PLAINTEXT://ip_of_machines_where_kafka_is_deployed:9092 #If there is a # at the beginning of this line, delete it and modifylog.dirs=/data/kafka_dev/logs/connect.logzookeeper.connect=ip_of_machines_where_kafka_is_deployed:2181
[root@VM-10-18-tencentos config]# vim connect-distributed.properties
group.id=connect-clusterbootstrap.servers=ip_of_machines_where_kafka_is_deployed:9092# Define the plug-in pathplugin.path=/data/kafka_connect/plugins
[root@VM-10-18-tencentos config]# cd /data/kafka_dev[root@VM-10-18-tencentos kafka_dev]# nohup bin/zookeeper-server-start.sh config/zookeeper.properties &> zookeeper.log &
[root@VM-10-18-tencentos kafka_dev]# jobs
[root@VM-10-18-tencentos kafka_dev]# nohup bin/kafka-server-start.sh config/server.properties &> kafka.log &
[root@VM-10-18-tencentos kafka_dev]# jobs

show wal_level;

CREATE PUBLICATION pg_demo_publication FOR ALL TABLES;
CREATE PUBLICATION pg_demo_publication FOR table_name1, table_name2;
SELECT * FROM pg_publication_tables WHERE pubname = ‘pg_demo_publication’;
SELECT * FROM pg_publication WHERE pubname = ‘pg_demo_publication’;
CREATE EXTENSION tencentdb_failover_slot;
SELECT pg_create_logical_failover_slot(‘failover_alot_name’,’pgoutput’);
SELECT * FROM pg_failover_slots;
[root@VM-10-18-tencentos ~]# mkdir -p /data/kafka_connect/plugins[root@VM-10-18-tencentos ~]# wget https://repo1.maven.org/maven2/io/debezium/debezium-connector-postgres/2.7.3.Final/debezium-connector-postgres-2.7.3.Final-plugin.tar.gz[root@VM-10-18-tencentos ~]# tar -zxvf debezium-connector-postgres-2.7.3.Final-plugin.tar.gz -C /data/kafka_connect/plugins
[root@VM-10-18-tencentos ~]# cd /data/kafka_dev[root@VM-10-18-tencentos kafka_dev]# nohup bin/connect-distributed.sh config/connect-distributed.properties &> connect.log &
curl -XPOST "http://ip_of_CVM_where_kafka_is_deployed:8083/connectors/" \\-H 'Content-Type: application/json' \\-d '{"name": "test_connector","config": {"connector.class": "io.debezium.connector.postgresql.PostgresConnector","database.hostname": "IP address of the machine where the PostgreSQL database is deployed""database.port": "5432","database.user": "PostgreSQL username with permission to release""database.password": "Password of the publishing user""database.dbname": "Database for creating publication""database.server.name": "pg_demo","slot.name": "pg_demo_failover_slot","topic.prefix": "pg_demo","publication.name": "pg_demo_publication","publication.autocreate.mode": "all_tables","plugin.name": "pgoutput"}}'
Parameter | Description |
name | Connector name. Must be unique. |
database.hostname | IP address of the cloud database. It is recommended to fill in the private network IP. |
database.user | The username used to connect to a cloud database. The user needs sufficient permissions to complete the publishing. It is recommended to use a user of type pg_tecenten_superuser. |
database.password | The user's password. |
database.dbname | Database name for creating publication. |
slot.name | Name of the logical replication slot. Please enter the name of the logical replication slot created earlier. |
publication.name | Name of the logical replication. Please enter the name of the logical release created earlier. |
SELECT * FROM pg_publication;
SELECT * FROM pg_failover_slots;
curl "http://ip_of_machine_where_kafka_is_deployed:8083/connectors/pg_demo_connector/status"
[root@VM-10-18-tencentos kafka_dev]# su – postgres[postgres@VM-10-18-tencentos ~]$ /usr/local/pgsql/bin/psql -h *.*.*.* -p 5432 -U dbadmin -d postgresPassword for user dbadmin:psql (16.4, server 16.8)Type "help" for help.postgres=>
postgres=> CREATE TABLE linktest (id SERIAL PRIMARY KEY);CREATE TABLEpostgres=> insert into linktest values(1);INSERT 0 1
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan