debezium-postgres.td.initialize 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. #
  10. # Note that this file is *not* reentrant. Neither Postgres nor
  11. # Debezium allow error-free dropping of objects (users or connectors)
  12. # that may or may not exist using the same set of commands for all
  13. # cases.
  14. #
  15. # Furthermore, doing a couple of REST calls against the same Debezium
  16. # connector is an easy way to bork it, so please always do
  17. #
  18. # ./mzcompose -down v
  19. #
  20. # before running this test framework again.
  21. #
  22. #
  23. # Configure the Postgres side
  24. #
  25. # we could use postgres:postgres as our Debezium user, however our
  26. # documentation suggests the creation of a dedicated user, so
  27. # we do the same in the test.
  28. #
  29. $ postgres-execute connection=postgres://postgres:postgres@postgres
  30. CREATE USER debezium WITH SUPERUSER PASSWORD 'debezium';
  31. GRANT ALL PRIVILEGES ON DATABASE "postgres" TO debezium;
  32. GRANT ALL PRIVILEGES ON SCHEMA "public" TO debezium;
  33. #
  34. # Configure the Debezium side
  35. #
  36. $ http-request method=POST url=http://debezium:8083/connectors content-type=application/json
  37. {
  38. "name": "psql-connector",
  39. "config": {
  40. "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
  41. "database.hostname": "postgres",
  42. "database.port": "5432",
  43. "database.user": "debezium",
  44. "database.password": "debezium",
  45. "database.dbname" : "postgres",
  46. "database.server.name": "postgres",
  47. "plugin.name": "pgoutput",
  48. "slot.name" : "tester",
  49. "database.history.kafka.bootstrap.servers": "kafka:9092",
  50. "database.history.kafka.topic": "schema-changes.history",
  51. "truncate.handling.mode": "include",
  52. "decimal.handling.mode": "precise",
  53. "topic.prefix": "postgres"
  54. }
  55. }
  56. # Increase table and source limit because the Postgres test tends to create a lot of tables and sources
  57. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  58. ALTER SYSTEM SET max_tables = 1000
  59. ALTER SYSTEM SET max_sources = 1000
  60. # Sleep for 10 seconds, as Debezium may fail to replicate any
  61. # postgresql statements that come immediately afterwards
  62. $ sleep-is-probably-flaky-i-have-justified-my-need-with-a-comment duration="10s"