Skip to content

Commit

Permalink
Add podman-compose.yml
Browse files Browse the repository at this point in the history
To quickly launch Redis services like:

single instance, master + replicas and sentinel group
  • Loading branch information
jlledom committed Feb 29, 2024
1 parent 51825f1 commit acb047b
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ bench.txt
3scale_backend.sock

.env

/script/config/sentinel1/sentinel1.conf
/script/config/sentinel2/sentinel2.conf
/script/config/sentinel3/sentinel3.conf
/script/config/twemproxy.yml
90 changes: 90 additions & 0 deletions script/config/podman-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
version: '3'
services:
redis-master:
image: redis:6.2-alpine
container_name: redis-master
network_mode: "host"
ports:
- "6379:6379"
command: [ redis-server, --port, "6379" ]

redis-replica1:
image: redis:6.2-alpine
container_name: redis-replica1
network_mode: "host"
ports:
- "6380:6380"
command: [ redis-server, --slaveof, localhost, "6379", --port, "6380" ]

redis-replica2:
image: redis:6.2-alpine
container_name: redis-replica2
network_mode: "host"
ports:
- "6381:6381"
command: [ redis-server, --slaveof, localhost, "6379", --port, "6381" ]

redis-sentinel1:
image: redis:6.2-alpine
container_name: redis-sentinel1
network_mode: "host"
ports:
- "26379:26379"
volumes:
- ./sentinel1:/data:Z
command: [ redis-server, /data/sentinel1.conf, --sentinel, --port, "26379" ]

redis-sentinel2:
image: redis:6.2-alpine
container_name: redis-sentinel2
network_mode: "host"
ports:
- "26380:26380"
volumes:
- ./sentinel2:/data:Z
command: [ redis-server, /data/sentinel2.conf, --sentinel, --port, "26380" ]

redis-sentinel3:
image: redis:6.2-alpine
container_name: redis-sentinel3
network_mode: "host"
ports:
- "26381:26381"
volumes:
- ./sentinel3:/data:Z
command: [ redis-server, /data/sentinel3.conf, --sentinel, --port, "26381" ]

redis-shard1:
image: redis:6.2-alpine
container_name: redis-shard1
network_mode: "host"
ports:
- "6382:6382"
command: [ redis-server, --port, "6382" ]

redis-shard2:
image: redis:6.2-alpine
container_name: redis-shard2
network_mode: "host"
ports:
- "6383:6383"
command: [ redis-server, --port, "6383" ]

redis-shard3:
image: redis:6.2-alpine
container_name: redis-shard3
network_mode: "host"
ports:
- "6384:6384"
command: [ redis-server, --port, "6384" ]

twemproxy:
image: quay.io/3scale/twemproxy:v0.5.0
container_name: twemproxy
network_mode: "host"
environment:
- TWEMPROXY_CONFIG_FILE=/etc/twemproxy/nutcracker.yml
ports:
- "22121:22121"
volumes:
- ./twemproxy.yml:/etc/twemproxy/nutcracker.yml:Z
4 changes: 4 additions & 0 deletions script/config/sentinel1_template/sentinel1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
port 26379
sentinel monitor redis-master ::1 6379 2
sentinel down-after-milliseconds redis-master 5000
sentinel failover-timeout redis-master 60000
4 changes: 4 additions & 0 deletions script/config/sentinel2_template/sentinel2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
port 26380
sentinel monitor redis-master ::1 6379 2
sentinel down-after-milliseconds redis-master 5000
sentinel failover-timeout redis-master 60000
4 changes: 4 additions & 0 deletions script/config/sentinel3_template/sentinel3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
port 26381
sentinel monitor redis-master ::1 6379 2
sentinel down-after-milliseconds redis-master 5000
sentinel failover-timeout redis-master 60000
13 changes: 13 additions & 0 deletions script/config/twemproxy_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
alpha:
listen: 127.0.0.1:22121
hash: fnv1a_64
hash_tag: "{}"
distribution: ketama
auto_eject_hosts: true
redis: true
server_retry_timeout: 2000
server_failure_limit: 1
servers:
- 127.0.0.1:6382:1 shard1
- 127.0.0.1:6383:1 shard2
- 127.0.0.1:6384:1 shard3

0 comments on commit acb047b

Please sign in to comment.