docker-redis叢集
目錄
介紹
- 簡化部署
redis
- redis.sh指令碼,在任意目錄執行都行
#!/bin/bash
mkdir -p /data/redis/700{1..6}/data
cd /data/redis/
echo "version: '3'
services:
redis1:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/7001/data:/data
environment:
- REDIS_PORT=7001
redis2:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/7002/data:/data
environment:
- REDIS_PORT=7002
redis3:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/7003/data:/data
environment:
- REDIS_PORT=7003
redis4:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/7004/data:/data
environment:
- REDIS_PORT=7004
redis5:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/7005/data:/data
environment:
- REDIS_PORT=7005
redis6:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/7006/data:/data
environment:
- REDIS_PORT=7006" > docker-compose.yml
docker-compose up -d # 需要安裝docker-compose
docker-compose up -d 執行後會出現,都為up則啟動成功 注意埠是否被佔用
Name Command State Ports
---------------------------------------------------------------
redis_redis1_1 /usr/local/bin/entrypoint. ... Up
redis_redis2_1 /usr/local/bin/entrypoint. ... Up
redis_redis3_1 /usr/local/bin/entrypoint. ... Up
redis_redis4_1 /usr/local/bin/entrypoint. ... Up
redis_redis5_1 /usr/local/bin/entrypoint. ... Up
redis_redis6_1 /usr/local/bin/entrypoint. ... Up
redis-cluster叢集配置
上述只是啟動了6個redis容器,並沒有設定叢集,隨便進入一個redis容器,執行下面的命令,IP替換成自己宿主機的IP,雲伺服器換成外網ip
docker exec -ti d3a904cc0d5a bash
redis-cli --cluster create 192.168.1.100:7001 192.168.1.100:7002 192.168.1.100:7003 192.168.1.100:7004 192.168.1.100:7005 192.168.1.100:7006 --cluster-replicas 1
> 會詢問是否開啟叢集
> 輸入yes即可
> Can I set the above configuration? (type 'yes' to accept): yes
相關文章
- Zookeeper叢集 + Kafka叢集Kafka
- 搭建zookeeper叢集(偽叢集)
- zookeeper叢集及kafka叢集搭建Kafka
- Redis系列:搭建Redis叢集(叢集模式)Redis模式
- linux下搭建ZooKeeper叢集(偽叢集)Linux
- redis偽叢集配置Cluster叢集模式Redis模式
- redis叢集Redis
- ceph叢集
- redis 叢集Redis
- RabbitMQ叢集MQ
- ES叢集
- 將Standard標準叢集修改為Flex叢集Flex
- 基於Dokcer搭建Redis叢集(主從叢集)Redis
- docker下,極速搭建spark叢集(含hdfs叢集)DockerSpark
- 用Docker搭建RabbitMq的普通叢集和映象叢集DockerMQ
- 管理 ES 叢集:集常見的叢集部署方式
- MongoDB叢集同步MongoDB
- 分片叢集元件元件
- 部署分片叢集
- RabbitMQ 映象叢集MQ
- Hadoop叢集搭建Hadoop
- Zookeeper叢集搭建
- redis叢集原理Redis
- redis叢集搭建Redis
- mysql叢集搭建MySql
- akka 叢集分片
- zookeeper 叢集搭建
- 搭建 Redis 叢集Redis
- RabbitMQ叢集搭建MQ
- nacos 叢集搭建
- Linux 叢集化Linux
- node叢集(cluster)
- HBASE叢集搭建
- Kafka叢集配置Kafka
- 搭建ELK叢集
- Ambari叢集搭建
- Redis cluster 叢集Redis
- kafka叢集搭建Kafka