01-configure-sinks.td 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  10. ALTER SYSTEM SET unsafe_enable_unorchestrated_cluster_replicas = true
  11. > DROP SOURCE IF EXISTS mz_source CASCADE;
  12. > DROP SECRET IF EXISTS pgpass CASCADE;
  13. > CREATE CLUSTER storage REPLICAS (
  14. r1 (
  15. STORAGECTL ADDRESSES ['clusterd1:2100'],
  16. STORAGE ADDRESSES ['clusterd1:2103'],
  17. COMPUTECTL ADDRESSES ['clusterd1:2101'],
  18. COMPUTE ADDRESSES ['clusterd1:2102'],
  19. WORKERS 4
  20. )
  21. )
  22. > CREATE CONNECTION kafka_conn
  23. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  24. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  25. URL '${testdrive.schema-registry-url}'
  26. );
  27. > CREATE MATERIALIZED VIEW v1 AS
  28. SELECT 1 as col
  29. > CREATE SINK snk
  30. IN CLUSTER storage
  31. FROM v1
  32. INTO KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-snk-${testdrive.seed}')
  33. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  34. ENVELOPE DEBEZIUM