Debezium + mysql + postgres (воссоздайте пример Debezium-jdbc-demo)MySql

Форум по Mysql
Ответить
Anonymous
 Debezium + mysql + postgres (воссоздайте пример Debezium-jdbc-demo)

Сообщение Anonymous »

Я хочу попробовать воспроизвести этот пример кода на GitHub.

Код: Выделить всё

git clone https://github.com/Naros/debezium-jdbc-demo.git
cd debezium-jdbc-demo

docker compose up
< /code>

новый терминал < /p>
curl.exe -X POST http://localhost:8083/connectors -H "Content-Type: application/json" -d @register-source-mysql.json | jq
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  1210  100   593  100   617    908    944 --:--:-- --:--:-- --:--:--  1852
{
"name": "source-mysql",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"database.hostname": "mysql",
"database.user": "root",
"database.password": "debezium",
"database.port": "3306",
"database.server.name": "mysql",
"database.server.id": "12345",
"driver.connectionTimeZone": "Europe/Vienna",
"topic.prefix": "mysql",
"snapshot.mode": "initial",
"table.include.list": "inventory.customers,inventory.addresses",
"schema.history.internal.kafka.bootstrap.servers": "kafka:9092",
"schema.history.internal.kafka.topic": "mysql-database-history",
"name": "source-mysql"
},
"tasks": [],
"type": "source"
}
PS debezium-jdbc-demo> curl.exe -X POST http://localhost:8083/connectors -H "Content-Type: application/json"-d @register-sink-postgres.json | jq
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  1113  100   549  100   564  13316  13680 --:--:-- --:--:-- --:--:-- 27146
{
"name": "sink-postgres",
"config": {
"connector.class": "io.debezium.connector.jdbc.JdbcSinkConnector",
"topics": "mysql.inventory.customers,mysql_propagation.inventory.customers",
"hibernate.dialect": "org.hibernate.dialect.PostgreSQLDialect",
"connection.url": "jdbc:postgresql://postgres:5432/postgres",
"connection.username": "postgres",
"connection.password": "dbz",
"database.time_zone": "Europe/Vienna",
"schema.evolution": "basic",
"insert.mode": "upsert",
"delete.enabled": "true",
"primary.key.mode": "record_key",
"name": "sink-postgres"
},
"tasks": [],
"type": "sink"
}
PS debezium-jdbc-demo> curl.exe -X GET http://localhost:8083/connectors | jq
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100    32  100    32    0     0   1025      0 --:--:-- --:--:-- --:--:--  1032
[
"sink-postgres",
"source-mysql"
]
< /code>
Похоже, у меня есть раковина и источник, настроенный < /p>

Соединение MySQL: < /p>
docker exec -it jdbc-mysql mysql -h localhost -P 3306 -u mysqluser -p
password: dbz

mysql> INSERT INTO inventory.customers (id, first_name, last_name, email) VALUES (1005, 'Testy', 'McTestface', 'test@example.com');
Query OK, 1 row affected (0.01 sec)

mysql>  SELECT * FROM inventory.customers;
+------+------------+------------+-----------------------+
| id   | first_name | last_name  | email                 |
+------+------------+------------+-----------------------+
| 1001 | Sally      | Thomas     | sally.thomas@acme.com |
| 1002 | George     | Bailey     | gbailey@foobar.com    |
| 1003 | Edward     | Walker     | ed@walker.com         |
| 1004 | Anne       | Kretchmar  | annek@noanswer.org    |
| 1005 | Testy      | McTestface | test@example.com      |
+------+------------+------------+-----------------------+
5 rows in set (0.00 sec)

< /code>
Новая запись была добавлена < /p>

postgres: < /p>
docker exec -it jdbc-postgres psql --username=postgres
postgres=# SELECT * FROM inventory.customers;
id | first_name | last_name | email
------+------------+-----------+-----------------------
1001 | Sally | Thomas | sally.thomas@acme.com
1002 | George | Bailey | gbailey@foobar.com
1003 | Edward | Walker | ed@walker.com
1004 | Anne | Kretchmar | annek@noanswer.org
(4 rows)

< /code>
Однако запись не была обновлена, так как файл readme, кажется, указывает на это. что -то.

Подробнее здесь: https://stackoverflow.com/questions/797 ... mo-example
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «MySql»