Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 1.85 KB

README.md

File metadata and controls

65 lines (44 loc) · 1.85 KB

Cockroach to AMQP bridge

Sync change data to RabbitMQ from CockroachDB

cockroach-amqp-bridge

Introduction

For traditional database, we have Canal, Maxwell for mysql, or pg-amqp-bridge for Postgresql, to synchronize change data from database to rabbitmq.

This tool achieves same feature via experimental core changefeed for CockroachDB.

Configuration

Configuration is done through environment variables:

  • DATABASE_URL: e.g. postgresql://username:[email protected]:port/database
  • AMQP_URL: e.g. amqp://rabbitmq//
  • AMQP_EXCHANGE: rabbitmq exchange name to publish messages
  • TABLES: e.g. users,orders,goods

Running from source

Install Rust

curl https://sh.rustup.rs -sSf | sh

Run

DATABASE_URL="postgres://root@localhost:26257/db" \
TABLES="users,orders,goods" \
AMQP_URL="amqp://localhost//" \
AMQP_EXCHANGE="cockroach_change_feed" \
RUST_LOG=info \
cargo run

Running as docker container

docker run --rm -it --net=host \
-e DATABASE_URL="postgres://postgres@localhost:26257/db" \
-e TABLES="users,orders,goods" \
-e AMQP_URL="amqp://localhost//" \
-e AMQP_EXCHANGE="cockroach_change_feed" \
-e RUST_LOG=info \
firevale/cockroach-amqp-bridge

Contributing

Anyone and everyone is welcome to contribute.

Author

@xbinxu

License

Copyright © 2013-Present 北京火谷网络科技股份有限公司
This source code is licensed under MIT license