Install With Docker Compose

Start three Meta voters and one primary–follower Group with the 0.2.0 cluster image.

Understand The Example

This single-host lab uses eloqdata/lavik:0.2.0-cluster from Docker Hub, three Meta voters and two Data nodes in Redis Cluster mode. One Group owns all 16,384 slots. Named volumes preserve Meta and Data state. Three containers on one host do not provide host-level HA; place members on separate hosts for that failure domain.

The private Docker network is 172.30.92.0/24; check for conflicts before starting. Host ports 6379 and 6380 bind only to loopback. Cluster clients must reach the advertised container addresses, so run these client examples inside the Compose network. Internal control traffic is plaintext in this local lab.

1. Download And Start

Linux · bash
# Run in Bash; stop on a failed download, checksum, extraction or image pull.
set -euo pipefail
mkdir -p lavik-0.2.0-build
cd lavik-0.2.0-build
curl -fLO --retry 3 https://github.com/eloqdata/lavik-agent/releases/download/docker-v0.2.0-2/docker-source.tar.gz
printf '%s\n' '2e7493cd2e1a4d5c115589aa3bd599ef8366779cb722b93baba7a096535b1d9d  docker-source.tar.gz' | sha256sum -c -
tar -xzf docker-source.tar.gz
cd lavik-0.2.0-docker
docker compose pull
Linux · bash
set -euo pipefail
docker compose up -d
# Allow transient not-ready (2) and unavailable (3) responses during recovery.
wait_for_cluster() {
  local attempt status
  for attempt in {1..60}; do
    if docker compose exec -T meta-1 lavik-ctl cluster-status \
      --socket /data/meta/meta-admin.sock --allow-plaintext-admin \
      --timeout-ms 3000 --json; then
      return 0
    else
      status=$?
    fi
    case "$status" in
      2|3) sleep 2 ;;
      *) return "$status" ;;
    esac
  done
  echo 'Cluster was not ready within 60 checks; inspect docker compose logs.' >&2
  return 1
}
wait_for_cluster
docker compose logs bootstrap
docker compose ps

Data nodes open their Redis port after Meta commits creation. The bootstrap service waits for Meta health and Data process startup, then creates the topology once. Exit status 2 or 3 from cluster-status means not ready or unavailable; inspect progress and retry the status read, not cluster-create.

2. Read And Write

Linux · bash
docker compose exec -T primary redis-cli -c SET greeting 'hello from Lavik'
docker compose exec -T primary redis-cli -c GET greeting
docker compose exec -T follower redis-cli --raw <<'COMMANDS'
READONLY
GET greeting
COMMANDS

The follower read can lag the primary. READONLY and GET must use the same connection. Multi-key requests in Cluster mode must use keys in the same hash slot.

3. Restart Without Reinitializing

Linux · bash
set -euo pipefail
docker compose stop --timeout 60
docker compose up -d
# Allow transient not-ready (2) and unavailable (3) responses during recovery.
wait_for_cluster() {
  local attempt status
  for attempt in {1..60}; do
    if docker compose exec -T meta-1 lavik-ctl cluster-status \
      --socket /data/meta/meta-admin.sock --allow-plaintext-admin \
      --timeout-ms 3000 --json; then
      return 0
    else
      status=$?
    fi
    case "$status" in
      2|3) sleep 2 ;;
      *) return "$status" ;;
    esac
  done
  echo 'Cluster was not ready within 60 checks; inspect docker compose logs.' >&2
  return 1
}
wait_for_cluster

Keep the five named volumes. Do not run docker compose down -v to restart: that deletes stored state. The 0.2.0 image recognizes Meta’s RAFT marker and omits the initial manifest on restart. Keep the original member identities and manifest.

Manage Failover And Monitoring With lavik-ctl →