> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/concepts/resources/nilus/cdc/sample-configs.md).

# CDC Sample Configs

All examples below use the current Nilus pipeline shape:

```yaml
type: nilus
spec:
  type: cdc
```

Before using these samples, confirm the source-side CDC prerequisites on the connector page: replication or log settings, user permissions, retention window, and primary key or replica-identity expectations.

### PostgreSQL

<details>

<summary>Basic</summary>

```yaml
name: nilus-postgres-cdc
version: v1alpha
type: nilus
spec:
  type: cdc
  compute: universe-compute
  source:
    address: dataos://ncdcpostgres
    options:
      strategy: flatten
    cdc:
      schema.include.list: "public"
      table.include.list: "public.orders"
      topic.prefix: "cdc_changelog"
      slot.name: "orders_slot"
      heartbeat.interval.ms: 60000
  sink:
    address: dataos://testinglh
    options:
      dest_table: pgdb_cdc
      incremental_strategy: append
      aws_region: us-west-2
```

</details>

<details>

<summary>Working with partitioned tables</summary>

```yaml
name: nilus-postgres-partitions
version: v1alpha
type: nilus
spec:
  type: cdc
  compute: universe-compute
  source:
    address: dataos://ncdcpostgres
    options:
      strategy: flatten
    cdc:
      schema.include.list: "public"
      table.include.list: "public.orders,public.orders_ny,public.orders_sf"
      topic.prefix: "cdc_changelog"
      slot.name: "orders_partition_slot"
      publication.name: "orders_pub"
      heartbeat.interval.ms: 60000
  sink:
    address: dataos://testinglh
    options:
      dest_table: pgdb_cdc
      incremental_strategy: append
      aws_region: us-west-2
```

</details>

### MongoDB

```yaml
name: nilus-mongo-cdc
version: v1alpha
type: nilus
spec:
  type: cdc
  compute: universe-compute
  source:
    address: dataos://ncdcmongodb2
    options:
      strategy: flatten
      max_table_nesting: 0
    cdc:
      collection.include.list: "retail.products"
      topic.prefix: "cdc_changelog"
      transforms.unwrap.array.encoding: array
  sink:
    address: dataos://testinglh
    options:
      dest_table: mdb_cdc
      incremental_strategy: append
```

### MS SQL Server

```yaml
name: nilus-mssql-cdc
version: v1alpha
type: nilus
spec:
  type: cdc
  compute: universe-compute
  source:
    address: dataos://mssqldepotnoper
    options:
      strategy: flatten
    cdc:
      table.include.list: "sandbox.customers"
      topic.prefix: "mssql"
      max.batch.size: 5000
      max.queue.size: 20000
      heartbeat.interval.ms: 60000
      poll.interval.ms: 5000
  sink:
    address: dataos://testawslh
    options:
      dest_table: sandbox.customers_cdc
      incremental_strategy: append
```

### MySQL

```yaml
name: nilus-mysql-cdc
version: v1alpha
type: nilus
spec:
  type: cdc
  compute: universe-compute
  source:
    address: mysql://{MYSQL_USERNAME}:{MYSQL_PASSWORD}@mysql.example.com:3306
    options:
      strategy: flatten
    cdc:
      table.include.list: "sales.orders"
      topic.prefix: "sales_cdc"
      snapshot.mode: initial
      heartbeat.interval.ms: 60000
      max.batch.size: 2048
      max.queue.size: 8192
  sink:
    address: dataos://analytics-lakehouse
    options:
      dest_table: sales.orders_cdc
      incremental_strategy: append
```

### IBM Db2

```yaml
name: nilus-db2-cdc
version: v1alpha
type: nilus
spec:
  type: cdc
  compute: universe-compute
  source:
    address: db2://{DB2_USERNAME}:{DB2_PASSWORD}@db2.example.com:50000/sample
    options:
      strategy: flatten
    cdc:
      table.include.list: "DB2INST1.CUSTOMERS"
      topic.prefix: "db2_cdc"
      snapshot.mode: initial
      max.batch.size: 2048
      max.queue.size: 8192
  sink:
    address: dataos://analytics-lakehouse
    options:
      dest_table: db2inst1.customers_cdc
      incremental_strategy: append
```

## Related docs

* [Understanding CDC Pipeline Config](/concepts/resources/nilus/cdc/service-config.md)
* [Batch Sample Configs](/concepts/resources/nilus/batch/sample-configs.md)
* [Stream Sample Configs](/concepts/resources/nilus/stream/sample-configs.md)
* [Optimize Sink Datasets](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets.md): tune `incremental_strategy`, `primary_key`, partitioning, and write batching for the destination.
* [Working with partitioned tables](/concepts/resources/nilus/troubleshooting/postgresql-cdc-partitioned-tables.md): required setup if your PostgreSQL source uses declarative partitioning.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/concepts/resources/nilus/cdc/sample-configs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
