Installation

ElasticRelay can be installed in multiple ways depending on your environment and preferences.

Prerequisites

Before installing ElasticRelay, ensure you have:

  • A supported database (MySQL 5.7+, PostgreSQL 10+, or MongoDB 4.0+)
  • Elasticsearch 7.x or 8.x
  • Linux, macOS, or Windows operating system

Download Binary

The easiest way to get started is to download a pre-built binary.

Linux (AMD64)

wget https://github.com/yogoosoft/ElasticRelay/releases/latest/download/elasticrelay-linux-amd64
chmod +x elasticrelay-linux-amd64
sudo mv elasticrelay-linux-amd64 /usr/local/bin/elasticrelay

Linux (ARM64)

wget https://github.com/yogoosoft/ElasticRelay/releases/latest/download/elasticrelay-linux-arm64
chmod +x elasticrelay-linux-arm64
sudo mv elasticrelay-linux-arm64 /usr/local/bin/elasticrelay

macOS (Intel)

wget https://github.com/yogoosoft/ElasticRelay/releases/latest/download/elasticrelay-darwin-amd64
chmod +x elasticrelay-darwin-amd64
sudo mv elasticrelay-darwin-amd64 /usr/local/bin/elasticrelay

macOS (Apple Silicon)

wget https://github.com/yogoosoft/ElasticRelay/releases/latest/download/elasticrelay-darwin-arm64
chmod +x elasticrelay-darwin-arm64
sudo mv elasticrelay-darwin-arm64 /usr/local/bin/elasticrelay

Windows

Download the Windows executable from the releases page:

# Download elasticrelay-windows-amd64.exe
# Add to your PATH or run directly

Docker

Run ElasticRelay using Docker:

docker pull yogoosoft/elasticrelay:latest

# Run with config file
docker run -v $(pwd)/config.json:/config.json \
  yogoosoft/elasticrelay:latest \
  --config /config.json

Docker Compose

Create a docker-compose.yml:

version: '3.8'

services:
  elasticrelay:
    image: yogoosoft/elasticrelay:latest
    volumes:
      - ./config.json:/config.json
      - ./data:/data
    command: --config /config.json
    restart: unless-stopped
    networks:
      - elasticrelay-net

networks:
  elasticrelay-net:
    driver: bridge

Run with:

docker-compose up -d

Kubernetes

Deploy ElasticRelay to Kubernetes using Helm:

# Add Helm repository
helm repo add elasticrelay https://yogoosoft.github.io/ElasticRelay/helm
helm repo update

# Install
helm install elasticrelay elasticrelay/elasticrelay \
  --set config.dataSources[0].type=mysql \
  --set config.dataSources[0].host=mysql.default.svc.cluster.local \
  --set config.elasticsearch.addresses[0]=http://elasticsearch:9200

Or create a values.yaml:

config:
  version: "3.0"
  dataSources:
    - id: mysql-main
      type: mysql
      host: mysql.default.svc.cluster.local
      port: 3306
      user: root
      password: password
      database: mydb
  elasticsearch:
    addresses:
      - http://elasticsearch:9200

Install with custom values:

helm install elasticrelay elasticrelay/elasticrelay -f values.yaml

Build from Source

If you prefer to build from source:

Prerequisites

  • Go 1.21 or higher
  • Git

Build Steps

# Clone repository
git clone https://github.com/yogoosoft/ElasticRelay.git
cd ElasticRelay

# Build
go build -o elasticrelay cmd/elasticrelay/main.go

# Install (optional)
sudo mv elasticrelay /usr/local/bin/

Verify Installation

Check that ElasticRelay is installed correctly:

elasticrelay --version

You should see output similar to:

ElasticRelay version 3.0.0

System Service (Linux)

To run ElasticRelay as a systemd service:

Create /etc/systemd/system/elasticrelay.service:

[Unit]
Description=ElasticRelay CDC Gateway
After=network.target

[Service]
Type=simple
User=elasticrelay
Group=elasticrelay
ExecStart=/usr/local/bin/elasticrelay --config /etc/elasticrelay/config.json
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable elasticrelay
sudo systemctl start elasticrelay
sudo systemctl status elasticrelay

What’s Next?