Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (18 sloc) 770 Bytes

搭建redis主从环境

cd /easy-tips/docker/redis-master-slave

执行下面命令,提供如下两种方式:

使用 docker-compose 编排

# 创建容器和启动容器
docker-compose up
# 创建容器和启动容器 并后台运行
docker-compose up -d
# 删除容器
docker-compose kill

手动创建和启动容器

docker build ./

docker run --name redis-master -p 60370:6379 -d redis:4-alpine <yourpath>/easy-tips/docker/redis-master-slave/redis.master.conf:/home/redis/redis.conf -d redis:4-alpine redis-server /home/redis/redis.conf

docker run --name redis-slave -p 60371:6379 -v <yourpath>/easy-tips/docker/redis-master-slave/redis.slave.conf:/home/redis/redis.conf -d redis:4-alpine redis-server /home/redis/redis.conf
You can’t perform that action at this time.