rancher install redis cluster

Based on the previous article: docker install rancher_RT_0114's blog -CSDN blog

The redis cluster was installed before, but it was installed on a single machine with docker. Docker build redis cluster_RT_0114's blog -CSDN blog

Come, record the installation of redis cluster by rancher. All machine firewalls are closed.

Yes, there are still three machines, master, mode1, and node2. The master does not deploy redis but is only used to share redis configuration files. Node1 and node2 deploy 3 redis respectively, a total of 6 redis.

Enter the master host to create a folder:
mkdir -p /water/runfile/docker_volume/redis_cluster/7001/datamkdir -p /water/runfile/docker_volume/redis_cluster/7002/datamkdir -p /water/runfile/docker_volume/redis_cluster/7003/datamkdir -p /water/runfile/docker_volume/redis_cluster/7004/datamkdir -p /water/runfile/docker_volume/redis_cluster/7005/datamkdir -p /water/runfile/docker_volume/redis_cluster/7006/data
Install nfs on the master:
cd /water/runfile/docker_volume/redis_clusterrpc.nfsd 8rpc.mountd exportfs -r#使配置生效 exportfs#可以查看到已经ok
Implementation process:
[[email protected] 7006]# cd /water/runfile/docker_volume/redis_cluster[[email protected] redis_cluster]# exportfs/water/runfile/docker_volume                172.21.168.195/24[[email protected] redis_cluster]#  
Create a configuration file:
vi /water/runfile/docker_volume/redis_cluster/7001/redis.confvi /water/runfile/docker_volume/redis_cluster/7002/redis.confvi /water/runfile/docker_volume/redis_cluster/7003/redis.confvi /water/runfile/docker_volume/redis_cluster/7004/redis.confvi /water/runfile/docker_volume/redis_cluster/7005/redis.confvi /water/runfile/docker_volume/redis_cluster/7006/redis.conf
Modification: 6 files but the port is different, others are the same
#bind 127.0.0.1port 7001  #端口cluster-enabled yes #启用集群模式cluster-config-file /data/nodes.confcluster-node-timeout 5000 #超时时间logfile "/data/redis.log" #输出日志appendonly yesdaemonize no #是否后台运行,这里不能改成yes,不然docker运行就关闭了protected-mode no #非保护模式pidfile  /var/run/redis.pid
Create pv in the default space
nfs-redisclutser-pv
NFS-Share 10
/water/runfile/docker_volume 172.21.168.195 Is
it read-only: No
Multi-host read-write
process:
Create pvc in the default space
Workload-Load Balancing-Service Discovery-PVC (Tick) -Pipeline
Select to add pvc
nfs-redisclutser-pvc Namespace: select the newly created redis-cluster
persistent volume (PV) Select: nfs-redisclutser-pv
Custom: multi-host Read and write
process:
Deploy redis: first manually pull the redis image.
Host scheduling: specify
Data volume: /water/runfile/docker_volume is configured in pvc, so you only need to configure the subordinate directory when configuring the following
Entry/Command:
The internet:
Just click OK.
Copy 5 more copies, change the port folder of the port and data volume respectively, and change the scheduled host to 3 redis for one machine.
Enter any redis:
Execution: Click yes, finish, 3 masters and 3 slaves.
redis-cli --cluster create 172.21.168.197:7001 172.21.168.197:7002 172.21.168.197:7005 172.21.168.199:7003 172.21.168.199:7004 172.21.168.199:7006 --cluster-replicas 1
cluster nodes View cluster nodes
cluster info: view cluster information
Give it a try: it’s not that easy, just do it again, it’s not difficult.