当你需要ChatAI服务但无法魔法或没有海外手机号码时,Chat8就是你的解决方案。我们基于OpenAi开发,所有用户内容都会加密,欢迎使用!点击使用:
https://chat.chat826.com/#/register?bronk_on=375671
redis集群方式有三种
1,主从集群
缺点,主节点宕机后无法使使用
2,哨兵模式集群
解决 主节点宕机后无法使使用
缺点,无法大量写入数据,无法存入海量数据
3,redis-cluster 集群
解决高可用,高并发,存入海量数据
缺点,需要多个redis实例
1,redis 下载
http://download.redis.io/releases/redis-6.0.6.tar.gz
2,添加配置文件
1.1、在redis.6380.conf文件中,添加内容
port 6380
bind 127.0.0.1
appendonly yes
appendfilename "appendonly.6380.aof"
cluster-enabled yes
cluster-config-file nodes.6380.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
1.2、在redis.6381.conf文件中,添加内容
port 6381
bind 127.0.0.1
appendonly yes
appendfilename "appendonly.6381.aof"
cluster-enabled yes
cluster-config-file nodes.6381.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
1.3、在redis.6382.conf文件中,添加内容
port 6382
bind 127.0.0.1
appendonly yes
appendfilename "appendonly.6382.aof"
cluster-enabled yes
cluster-config-file nodes.6382.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
1.4、在redis.6383.conf文件中,添加内容
port 6383
bind 127.0.0.1
appendonly yes
appendfilename "appendonly.6383.aof"
cluster-enabled yes
cluster-config-file nodes.6383.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
1.5、在redis.6384.conf文件中,添加内容
port 6384
bind 127.0.0.1
appendonly yes
appendfilename "appendonly.6384.aof"
cluster-enabled yes
cluster-config-file nodes.6380.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
1.6、在redis.6385.conf文件中,添加内容
port 6385
bind 127.0.0.1
appendonly yes
appendfilename "appendonly.6385.aof"
cluster-enabled yes
cluster-config-file nodes.6385.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
2,依次启动redis实例
1.1、启动 redis.6380.conf
redis-server.exe redis.6380.conf
1.2、启动redis.6381.conf
redis-server.exe redis.6381.conf
1.3、在redis.6382.conf文件中,添加内容
redis-server.exe redis.6382.conf
1.4、在redis.6383.conf文件中,添加内容
redis-server.exe redis.6383.conf
1.5、在redis.6384.conf文件中,添加内容
redis-server.exe redis.6384.conf
1.6、在redis.6385.conf文件中,添加内容
redis-server.exe redis.6385.conf
3,redis-cluster主从角色分配
条件
1、redis-trib.rb
步骤
1、ruby环境安装
1.1、ruby环境下载:http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe
1.2、ruby安装,双击安装
2、redis-3.2.2.gem文件安装
2.1、redis-3.2.2.gem下载地址:https://rubygems.org/gems/redis/versions/3.2.2
2.1、进入到Ruby22-x64目录中
执行安装命令
gem install –local redis-cluster\redis-3.2.2.gem
3、redis-trib.rb搭建redis-cluster主从
3.1、redis-trib.rb下载地址:https://github.com/beebol/redis-trib.rb
3.2、redis-trib.rb使用
进入到redis-trib.rb目录中
通过cmd使用redis-trib.rb
redis-trib.rb开始搭建
ruby redis-trib.rb create –replicas 1 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384 127.0.0.1:6385
3.3、redis-trib.rb redis-cluster集群状态检查
ruby redis-trib.rb check 127.0.0.1:6380
master 为主节点
slave 为子节点