CLI
Proxy
Features:
- The broker part of a Metadata responses from the origin are replaced with the ADVERTISED_LISTENER_URL. Routing subsequent traffic through the proxy.
The proxy subcommand is used to run as proxy for another Kafka compatible broker.
Usage: tansu proxy [OPTIONS]
Options:
--listener-url <LISTENER_URL>
The proxy will listen on this address [env: LISTENER_URL=] [default: tcp://0.0.0.0:9092]
--advertised-listener-url <ADVERTISED_LISTENER_URL>
This location is advertised to clients in metadata [env: ADVERTISED_LISTENER_URL=] [default: tcp://localhost:9092]
--origin-url <ORIGIN_URL>
The proxy will forward traffic to this origin broker [env: ORIGIN_URL=] [default: tcp://localhost:9092]
--otlp-endpoint-url <OTLP_ENDPOINT_URL>
OTEL Exporter OTLP endpoint [env: OTEL_EXPORTER_OTLP_ENDPOINT=]
-h, --help
Print help
The proxy subcommand will automatically load environment variables from a file named .env in the current directory or any of its parents.
Example
A compose.yaml using Tansu as a proxy for an Apache Kafka 4.1 broker:
---
services:
broker:
image: apache/kafka:4.1.0
environment:
KAFKA_NODE_ID: 1
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT"
KAFKA_LISTENERS: "CONTROLLER://:9093,PLAINTEXT://:9092"
KAFKA_ADVERTISED_LISTENERS: "CONTROLLER://:9093,PLAINTEXT://broker:9092"
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@broker:9093"
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
proxy:
image: ghcr.io/tansu-io/tansu
environment:
ORIGIN_URL: tcp://broker:9092
ADVERTISED_LISTENER_URL: tcp://0.0.0.0:9092
RUST_LOG: debug,tansu_sans_io=warn,tansu_model=warn
command: ["proxy"]
ports:
- 9092:9092
links:
- broker