基于docker搭建redis
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于docker搭建redis相关的知识,希望对你有一定的参考价值。
下载redis 3.2镜像
#docker pull redis:3.2
主
docker run -d -ti --net host --name 6379 -v /usr/local/redis/data6379:/data -v /usr/local/redis/redis6379.conf:/usr/local/redis/redis.conf docker.io/redis:3.2 redis-server /usr/local/redis/redis.conf
docker run -d -ti --net host --name 6380 -v /usr/local/redis/data6380:/data -v /usr/local/redis/redis6380.conf:/usr/local/redis/redis.conf docker.io/redis:3.2 redis-server /usr/local/redis/redis.conf
docker run -d -ti --net host --name 6381 -v /usr/local/redis/data6381:/data -v /usr/local/redis/redis6381.conf:/usr/local/redis/redis.conf docker.io/redis:3.2 redis-server /usr/local/redis/redis.conf
从
docker run -d -ti --net host --name 6382 -v /usr/local/redis/data6382:/data -v /usr/local/redis/redis6382.conf:/usr/local/redis/redis.conf docker.io/redis:3.2 redis-server /usr/local/redis/redis.conf
docker run -d -ti --net host --name 6383 -v /usr/local/redis/data6383:/data -v /usr/local/redis/redis6383.conf:/usr/local/redis/redis.conf docker.io/redis:3.2 redis-server /usr/local/redis/redis.conf
docker run -d -ti --net host --name 6384 -v /usr/local/redis/data6384:/data -v /usr/local/redis/redis6384.conf:/usr/local/redis/redis.conf docker.io/redis:3.2 redis-server /usr/local/redis/redis.conf
主6379 6382
主6380 6383
主6381 6384
创建集群
./redis-trib.rb create --replicas 1 172.16.0.11:6379 172.16.0.11:6380 172.16.0.11:6381 172.16.0.14:6382 172.16.0.14:6383 172.16.0.14:6384
以上是关于基于docker搭建redis的主要内容,如果未能解决你的问题,请参考以下文章