docker-compose部署Redis主从+哨兵

一、 镜像:

镜像这里选择redis:4 ,执行命令docker pull redis:4 即可

二、配置文件:

准备配置文件:

1. redis-master.conf: redis master的配置文件

2. redis-slave1.conf :slave1 的配置文件,主要配置了slaveof 

# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf

# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.

################################## INCLUDES ###################################

# Include one or more other config files here.  This is useful if you
# have a standard

你可能感兴趣的:(Java从开发到设计,docker,redis,容器)