# K2K Replicator

{% hint style="success" %}
Found an issue? Feed it back to us at [Github](https://github.com/orgs/lensesio/discussions), on [Slack](https://www.launchpass.com/lensesio), [Ask Marios](https://ask.lenses.io/) or [email](mailto:info@lenses.io).
{% endhint %}

{% hint style="warning" %}
To execute K2K, you must agree to the EULA and secure a free license.&#x20;

Accept the EULA by setting `license.acceptEula` to `true` .
{% endhint %}

The K2K application defines its replication behavior using a YAML configuration. This configuration can be structured as a single YAML file or be split across multiple files.

### Configuration Structure

The configuration file consists of the following sections:

#### Required Sections

**`source`** - Source cluster configuration\
Defines connection parameters and Kafka consumer properties for the source cluster.\
See: [Connections](/latest/k2k/configuration/connections.md)

**`target`** - Target cluster configuration\
Specifies connection parameters and Kafka producer properties for the target cluster.\
See: [Connections](/latest/k2k/configuration/connections.md)

**`replication`** - Replication flow definitions\
Contains replication flows that map source topics to target topics and define record routing.\
See: [Selecting topics](/latest/k2k/tutorial/selecting-topics.md)[Target Partition](/latest/k2k/configuration/target-partition.md)[Records routing](/latest/k2k/configuration/records-routing.md)[Source topics](/latest/k2k/configuration/source-topics.md)

**`coordination`** - State management configuration\
Configures internal coordination mechanisms, including offset tracking on the target cluster.\
See: [Connections](/latest/k2k/configuration/connections.md)

#### Optional Sections

**`features`** - Feature flags\
Controls advanced capabilities such as exactly-once semantics, schema replication, and tracing headers.\
See: [Exactly once](/latest/k2k/configuration/exactly-once.md), [Schema Replication](/latest/k2k/configuration/schema-replication.md)

**`errorHandling`** - Fault tolerance configuration\
Defines strategies for handling recoverable errors during replication operations.\
See: [Error Handling](/latest/k2k/configuration/error-handling.md)

**`tracing`** - Record enrichment configuration\
Configures tracing header injection for observability and data lineage tracking.\
See: [Tracing Headers](/latest/k2k/configuration/tracing-headers.md)

### Additional Configuration Topics

* Variables and Secrets - Environment variable substitution and credential management. See [Variables & Secrets](/latest/k2k/tutorial/variables-and-secrets.md)
* Metrics - Monitoring and observability configuration. See [Metrics](/latest/k2k/configuration/metrics.md) for details.

## **Schema Definition**

The full JSON Schema definition for the configuration is available on [GitHub](https://github.com/lensesio/json-schemas/blob/main/k2k/pipeline.schema.json). Refer to it for details on structure, types, and parameter constraints.

## Minimal Configuration

```yaml
name: "mini-k2k"
source:
  kafka:
    connection:
      "boot: "sourceKafka:9092"
    consumer:
      "group.id": "k2k.mini-k2k.source"
target:
  kafka:
    connection:
      servers: "targetKafka:9092"    
replication:
  - source:
      # choose to replicate the topic named my-topic
      topic: "my-topic"
  - sink:
      # use the original topic name as the target topic
      topic: source
      # replicate each record to the same partition as the
      # original topic 
      partition: source
```


---

# Agent Instructions: 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:

```
GET https://docs.lenses.io/latest/k2k/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
