Skip to content

Commit

Permalink
Update deps (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Dec 22, 2023
1 parent 9a78fd1 commit 92d3db0
Show file tree
Hide file tree
Showing 17 changed files with 360 additions and 92 deletions.
6 changes: 3 additions & 3 deletions cassandra-1-1/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
restart: always
depends_on:
- cassandra-one
image: shotover/shotover-proxy:v0.1.10
image: shotover/shotover-proxy:v0.2.0
network_mode: "service:cassandra-one"
volumes:
- .:/config
Expand All @@ -50,7 +50,7 @@ services:
restart: always
depends_on:
- cassandra-two
image: shotover/shotover-proxy:v0.1.10
image: shotover/shotover-proxy:v0.2.0
network_mode: "service:cassandra-two"
volumes:
- .:/config
Expand All @@ -59,7 +59,7 @@ services:
restart: always
depends_on:
- cassandra-three
image: shotover/shotover-proxy:v0.1.10
image: shotover/shotover-proxy:v0.2.0
network_mode: "service:cassandra-three"
volumes:
- .:/config
19 changes: 8 additions & 11 deletions cassandra-1-1/topology.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
sources:
cassandra_prod:
Cassandra:
- Cassandra:
name: cassandra
listen_addr: "0.0.0.0:9043"
chain_config:
main_chain:
- CassandraPeersRewrite:
port: 9043
- CassandraSinkSingle:
remote_address: "127.0.0.1:9042"
connect_timeout_ms: 3000
source_to_chain_mapping:
cassandra_prod: main_chain
chain:
- CassandraPeersRewrite:
port: 9043
- CassandraSinkSingle:
remote_address: "127.0.0.1:9042"
connect_timeout_ms: 3000
2 changes: 1 addition & 1 deletion cassandra-1-many/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
- cassandra-one
- cassandra-two
- cassandra-three
image: shotover/shotover-proxy:v0.1.10
image: shotover/shotover-proxy:v0.2.0
networks:
cassandra_subnet:
ipv4_address: 172.16.1.5
Expand Down
28 changes: 12 additions & 16 deletions cassandra-1-many/topology.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
---
sources:
cassandra_prod:
Cassandra:
- Cassandra:
name: cassandra
listen_addr: "0.0.0.0:9042"
chain_config:
main_chain:
- CassandraSinkCluster:
first_contact_points: ["172.16.1.2:9042", "172.16.1.3:9042"]
local_shotover_host_id: "2dd022d6-2937-4754-89d6-02d2933a8f7a"
shotover_nodes:
- address: "172.16.1.5:9042"
data_center: "dc1"
rack: "rack1"
host_id: "2dd022d6-2937-4754-89d6-02d2933a8f7a"
connect_timeout_ms: 3000

source_to_chain_mapping:
cassandra_prod: main_chain
chain:
- CassandraSinkCluster:
first_contact_points: ["172.16.1.2:9042", "172.16.1.3:9042"]
local_shotover_host_id: "2dd022d6-2937-4754-89d6-02d2933a8f7a"
shotover_nodes:
- address: "172.16.1.5:9042"
data_center: "dc1"
rack: "rack1"
host_id: "2dd022d6-2937-4754-89d6-02d2933a8f7a"
connect_timeout_ms: 3000
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@
The goal is to house example configs that run on the latest shotover release.

I'm just going to keep force pushing till I have something interesting here

## redis-backup-cluster

This example demonstrates how to setup shotover to maintain a redis backup cluster such that traffic could be diverted to the backup cluster in the case of complete failure of the primary cluster.
This is suitable for use cases where the data does not need to be 100% consistent between clusters but the service must not go down.

Shotover proxies messages to two distinct redis clusters:
* primary cluster - shotover reads and writes to this cluster
* backup cluster - all writes are duplicated to the backup cluster
3 changes: 3 additions & 0 deletions redis-backup-cluster/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
main_log_level: "info,shotover_proxy=info"
observability_interface: "0.0.0.0:9001"
210 changes: 210 additions & 0 deletions redis-backup-cluster/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
version: '3.3'
services:
redis-node-primary-0:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.10
environment: &environment_primary
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_NODES=redis-node-primary-0 redis-node-primary-1 redis-node-primary-2'
healthcheck:
&healthcheck_primary
test:
[
"CMD-SHELL",
"OUT=`redis-cli cluster slots`;
echo $$OUT | grep 172.16.1.10 || exit 1;
echo $$OUT | grep 172.16.1.11 || exit 1;
echo $$OUT | grep 172.16.1.12 || exit 1;
echo $$OUT | grep 172.16.1.13 || exit 1;
echo $$OUT | grep 172.16.1.14 || exit 1;
echo $$OUT | grep 172.16.1.15 || exit 1;"
]
interval: 1s
timeout: 3s
retries: 30

redis-node-primary-1:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.11
environment: *environment_primary
healthcheck: *healthcheck_primary

redis-node-primary-2:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.12
environment: *environment_primary
healthcheck: *healthcheck_primary

redis-node-primary-3:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.13
environment: *environment_primary
healthcheck: *healthcheck_primary

redis-node-primary-4:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.14
environment: *environment_primary
healthcheck: *healthcheck_primary

redis-node-primary-5:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.15
environment: *environment_primary
healthcheck: *healthcheck_primary

redis-node-backup-0:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.20
environment: &environment_backup
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_NODES=redis-node-backup-0 redis-node-backup-1 redis-node-backup-2'
healthcheck:
&healthcheck_backup
test:
[
"CMD-SHELL",
"OUT=`redis-cli cluster slots`;
echo $$OUT | grep 172.16.1.20 || exit 1;
echo $$OUT | grep 172.16.1.21 || exit 1;
echo $$OUT | grep 172.16.1.22 || exit 1;
echo $$OUT | grep 172.16.1.23 || exit 1;
echo $$OUT | grep 172.16.1.24 || exit 1;
echo $$OUT | grep 172.16.1.25 || exit 1;"
]
interval: 1s
timeout: 3s
retries: 30

redis-node-backup-1:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.21
environment: *environment_backup
healthcheck: *healthcheck_backup

redis-node-backup-2:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.22
environment: *environment_backup
healthcheck: *healthcheck_backup

redis-node-backup-3:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.23
environment: *environment_backup
healthcheck: *healthcheck_backup

redis-node-backup-4:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.24
environment: *environment_backup
healthcheck: *healthcheck_backup

redis-node-backup-5:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.25
environment: *environment_backup
healthcheck: *healthcheck_backup

redis-cluster-init-primary:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.2
depends_on:
- redis-node-primary-0
- redis-node-primary-1
- redis-node-primary-2
- redis-node-primary-3
- redis-node-primary-4
- redis-node-primary-5
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_CLUSTER_REPLICAS=1'
- 'REDIS_NODES=redis-node-primary-0 redis-node-primary-1 redis-node-primary-2 redis-node-primary-3 redis-node-primary-4 redis-node-primary-5'
- 'REDIS_CLUSTER_CREATOR=yes'

redis-cluster-init-backup:
image: bitnami/redis-cluster:6.0-debian-10
networks:
cluster_subnet:
ipv4_address: 172.16.1.3
depends_on:
- redis-node-backup-0
- redis-node-backup-1
- redis-node-backup-2
- redis-node-backup-3
- redis-node-backup-4
- redis-node-backup-5
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'
- 'REDIS_CLUSTER_REPLICAS=1'
- 'REDIS_NODES=redis-node-backup-0 redis-node-backup-1 redis-node-backup-2 redis-node-backup-3 redis-node-backup-4 redis-node-backup-5'
- 'REDIS_CLUSTER_CREATOR=yes'

shotover-0:
networks:
cluster_subnet:
ipv4_address: 172.16.1.4
depends_on:
redis-node-primary-0:
condition: service_healthy
redis-node-primary-1:
condition: service_healthy
redis-node-primary-2:
condition: service_healthy
redis-node-primary-3:
condition: service_healthy
redis-node-primary-4:
condition: service_healthy
redis-node-primary-5:
condition: service_healthy
redis-node-backup-0:
condition: service_healthy
redis-node-backup-1:
condition: service_healthy
redis-node-backup-2:
condition: service_healthy
redis-node-backup-3:
condition: service_healthy
redis-node-backup-4:
condition: service_healthy
redis-node-backup-5:
condition: service_healthy
image: shotover/shotover-proxy:v0.2.0
volumes:
- .:/config

networks:
cluster_subnet:
name: cluster_subnet
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.1.0/24
gateway: 172.16.1.1
38 changes: 38 additions & 0 deletions redis-backup-cluster/topology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
sources:
- Redis:
name: redis
listen_addr: "0.0.0.0:6379"
chain:
- Tee:
behavior: Ignore
buffer_size: 10000
chain:
# drop read requests to the backup cluster.
# This is needed for performance not correctness as the Tee would drop the actual read response anyway.
- QueryTypeFilter:
DenyList: [Read]
# submit requests to the backup cluster in batches of 2000 requests.
# this is another performance boost as it amortizes the cost of submitting a message.
- Coalesce:
flush_when_buffered_message_count: 2000
flush_when_millis_since_last_flush: 100
# and finally send the requests and receive their responses from the backup cluster.
- RedisSinkCluster:
first_contact_points:
- "172.16.1.20:6379"
- "172.16.1.21:6379"
- "172.16.1.22:6379"
- "172.16.1.23:6379"
- "172.16.1.24:6379"
- "172.16.1.25:6379"
connect_timeout_ms: 3000
- RedisSinkCluster:
first_contact_points:
- "172.16.1.10:6379"
- "172.16.1.11:6379"
- "172.16.1.12:6379"
- "172.16.1.13:6379"
- "172.16.1.14:6379"
- "172.16.1.15:6379"
connect_timeout_ms: 3000
Loading

0 comments on commit 92d3db0

Please sign in to comment.