Skip to content

Commit

Permalink
perf($Redis): support Redis master-slave replication
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Jul 31, 2021
1 parent 560fb9b commit d414b02
Show file tree
Hide file tree
Showing 33 changed files with 2,686 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
base-url: http://maf-zipkin:9411
devtools:
add-properties: true
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-development-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ spring:
add-properties: true
zipkin:
base-url: http://localhost:9411
redis:

redis:
master:
host: localhost
port: 6379
password: maf@redis
slaves:
- host: localhost
port: 6380
password: maf@redis

maf:
configuration:
web-security-enabled: false
web-security-enabled: true
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
add-properties: false
zipkin:
base-url: http://maf-zipkin:9411
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
add-properties: false
zipkin:
base-url: http://maf-zipkin:9411
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
add-properties: false
zipkin:
base-url: http://maf-zipkin:9411
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
14 changes: 10 additions & 4 deletions auth-center/src/main/resources/application-development-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ spring:
username: maf_mysql_rw
password: maf@mysql
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
host: maf-redis
port: 6379
password: maf@redis
rabbitmq:
host: maf-rabbitmq
port: 5672
username: maf_rabbitmq_su
password: maf@rabbitmq

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis

maf:
configuration:
swagger-enabled: true
16 changes: 11 additions & 5 deletions auth-center/src/main/resources/application-development-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ spring:
username: maf_mysql_rw
password: maf@mysql
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
host: localhost
port: 6379
password: maf@redis
rabbitmq:
host: localhost
port: 5672
username: maf_rabbitmq_su
password: maf@rabbitmq

# Configure logging level for the environment
redis:
master:
host: localhost
port: 6379
password: maf@redis
slaves:
- host: localhost
port: 6380
password: maf@redis

# Configure logging level for the environment
logging:
level:
com.baomidou: INFO
Expand Down
14 changes: 10 additions & 4 deletions auth-center/src/main/resources/application-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ spring:
username: maf_mysql_rw
password: maf@mysql
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
host: maf-redis
port: 6379
password: maf@redis
rabbitmq:
host: maf-rabbitmq
port: 5672
username: maf_rabbitmq_su
password: maf@rabbitmq

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis

maf:
configuration:
swagger-enabled: false
14 changes: 10 additions & 4 deletions auth-center/src/main/resources/application-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ spring:
username: maf_mysql_rw
password: maf@mysql
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
host: maf-redis
port: 6379
password: maf@redis
rabbitmq:
host: maf-rabbitmq
port: 5672
username: maf_rabbitmq_su
password: maf@rabbitmq

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis

maf:
configuration:
swagger-enabled: false
14 changes: 10 additions & 4 deletions auth-center/src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ spring:
username: maf_mysql_rw
password: maf@mysql
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
host: maf-redis
port: 6379
password: maf@redis
rabbitmq:
host: maf-rabbitmq
port: 5672
username: maf_rabbitmq_su
password: maf@rabbitmq

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis

maf:
configuration:
swagger-enabled: true
10 changes: 9 additions & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MAF_TAG=0.0.2
##################################################
MYSQL_SERVER_TAG=8.0.23-1.1.19
REDIS_TAG=6.2.5-alpine
REDIS_CLUSTER_TAG=6.2.5
ATMOZ_SFTP_TAG=alpine
MINIO_TAG=RELEASE.2021-06-17T00-10-46Z
RABBITMQ_TAG=3.8.14-management-alpine
Expand Down Expand Up @@ -35,7 +36,14 @@ SPRING_ENVIRONMENT=development-docker
############# Infrastructure Services ############
MYSQL_SERVER_MASTER_CONTAINER_NAME=maf-mysql-server-master
MYSQL_SERVER_SLAVE_CONTAINER_NAME=maf-mysql-server-slave
REDIS_CONTAINER_NAME=maf-redis
REDIS_MASTER_CONTAINER_NAME=maf-redis-master
REDIS_SLAVE_1_CONTAINER_NAME=maf-redis-slave-1
REDIS_NODE_1_CONTAINER_NAME=maf-redis-node-1
REDIS_NODE_2_CONTAINER_NAME=maf-redis-node-2
REDIS_NODE_3_CONTAINER_NAME=maf-redis-node-3
REDIS_NODE_4_CONTAINER_NAME=maf-redis-node-4
REDIS_NODE_5_CONTAINER_NAME=maf-redis-node-5
REDIS_NODE_6_CONTAINER_NAME=maf-redis-node-6
ATMOZ_SFTP_CONTAINER_NAME=maf-atmoz-sftp
MINIO_CONTAINER_NAME=maf-minio
RABBITMQ_CONTAINER_NAME=maf-rabbitmq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ loglevel notice
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile "redis.log"
logfile ""

# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
Expand Down Expand Up @@ -481,15 +481,15 @@ dir ./
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
#
# masterauth <master-password>
# masterauth maf@redis
#
# However this is not enough if you are using Redis ACLs (for Redis version
# 6 or greater), and the default user is not capable of running the PSYNC
# command and/or other commands needed for replication. In this case it's
# better to configure a special user to use with replication, and specify the
# masteruser configuration as such:
#
# masteruser <username>
# masteruser default
#
# When masteruser is specified, the replica will authenticate against its
# master using the new AUTH form: AUTH <username> <password>.
Expand Down
Loading

0 comments on commit d414b02

Please sign in to comment.