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叢集(偽叢集)
- web叢集與ejb叢集Web
- zookeeper叢集及kafka叢集搭建Kafka
- redis偽叢集配置Cluster叢集模式Redis模式
- Redis系列:搭建Redis叢集(叢集模式)Redis模式
- Redis叢集 - cluster叢集、資料分片Redis
- linux下搭建ZooKeeper叢集(偽叢集)Linux
- Zookeeper叢集 + Kafka叢集 + KafkaOffsetMonitor 監控薦Kafka
- mongodb副本叢集和分片叢集佈署MongoDB
- EJB叢集和Webservice叢集的討論Web
- RabbitMQ叢集MQ
- redis 叢集Redis
- 叢集搭建
- SolrCloud叢集SolrCloud
- redis叢集Redis
- ceph叢集
- 將Standard標準叢集修改為Flex叢集Flex
- 基於Dokcer搭建Redis叢集(主從叢集)Redis
- docker下,極速搭建spark叢集(含hdfs叢集)DockerSpark
- 用Docker搭建RabbitMq的普通叢集和映象叢集DockerMQ
- mongodb 3.4 叢集搭建升級版 五臺叢集MongoDB
- 急問:關於Web容器叢集和EJB叢集Web
- Kafka叢集配置Kafka
- Redis cluster 叢集Redis
- redis叢集搭建Redis
- nacos 叢集搭建
- redis系列:叢集Redis
- kafka叢集搭建Kafka
- Ambari叢集搭建
- 搭建ELK叢集
- RabbitMQ叢集搭建MQ
- HBASE叢集搭建
- zookeeper 叢集搭建
- mysql叢集搭建MySql
- Zookeeper叢集搭建
- 搭建 Redis 叢集Redis
- 搭建 zookeeper 叢集