当前位置:网站首页>redis分布式在线安装
redis分布式在线安装
2022-07-27 12:32:00 【风间净琉璃】
- CentOs 7.2
- redis-3.2.3.tar.gz
- 下面安装的用户为root
- 要求每台机器上必须要安装gcc、ruby、rubygems
- 安装gcc
- 命令
- yum -y install gcc gcc-c++
- 查看是否安装成功
- rpm –qa|grep gcc
- 安装ruby 和 rubygems
- 命令
- yum -y install ruby
- 查看是否安装成功
- rpm –qa|grep ruby
该文档拟定两台服务器的集群,每台服务器上三个实例,分别做主备。
IP地址 | 端口 | 角色 |
192.168.159.128 | 6379 | 主节点1 |
192.168.159.128 | 6380 | 主节点2 |
192.168.159.128 | 6381 | 主节点3 |
192.168.159.129 | 6379 | 备节点1 |
192.168.159.129 | 6380 | 备节点2 |
192.168.159.129 | 6381 | 备节点3 |
192.168.159.130 | 6379 | 备节点4 |
192.168.159.130 | 6380 | 备节点5 |
192.168.159.130 | 6381 | 备节点6 |
表格 3‑1 集群环境机器列表
- 将redis-3.2.3.tar.gz解压都每个机器上的/home/redis文件夹中
- 在/home/redis/redis-3.2.3路径下执行命令
- make
- make install
- 在每台机器的/home/redis目录下建立redis-cluster文件夹、在其中分别建立6379、6380和6381三个子文件夹
- 然后将redis-3.2.3文件夹中的redis.conf 复制到两台机器的6379、6380和6381文件夹中
- 修改对应的配置(改成下面的配置)
- port 6379 (根据端口来修改)
- bind 192.168.159.128(写对应机器的ip)
- repl-diskless-sync yes
- daemonize yes
- cluster-enabled yes
- maxmemory 40gb(最大缓存设置,单位mb或者gb)
- maxmemory-policy volatile-lru(回收策略算法设置,设置为:回收最近最少使用的键,但是只回收设置超时时间的键)
- pidfile : 指定端口,样例:/CFCA/redisPid/redis_6379.pid
- logfile : 在每个节点文件夹中根据端口号制定日志文件,样例:“./端口.log”
- save : 将磁盘持久化功能禁用禁用掉:
- #save 900 1
- #save 300 10
- #save 60 10000
- Cluster-config-file : 改为端口号对应的名称
- node-端口号.conf
- cluster-node-timeout 30000
- cluster-require-full-coverage no
- 启动节点
- 分别在两台机器的6380、6381和6382文件夹下执行下面命令,启动对应的redis实例
- redis-server redis.conf
- 将六个实例添加到一个集群中
- 这里需要安装一个redis 和 ruby的接口
- gem install redis(注意:需要设置服务器时间同步,才能安装成功)
- 在/home/redis/redis-3.2.3/src目录下执行下面命令
- ./redis-trib.rb create --replicas 1
192.168.159.128:6379 192.168.159.128:6380 192.168.159.128:6381 192.168.159.129:6379 192.168.159.129:6379 192.168.159.129:6380
192.168.159.129:6381 192.168.159.130:6379
192.168.159. 130:6380 192.168.159. 130:6381
- 此时可以redis-cli -h ip地址 -p 端口号 进入redis客户端,然后通过下面命令查看redis的集群情况
- cluster nodes
边栏推荐
- The strongest distributed locking tool: redisson
- 概述有名内部类与匿名内部类
- 配置更改删除了路由过滤器,分布路由器不堪重负:加拿大网络大瘫痪
- The chess robot "broke" the chess boy's finger...
- Fundamentals of mathematics 02 - sequence limit
- Top 10 in the 5.3 billion Bi Market: fansoft, Microsoft, Yonghong, sap, Baidu, IBM, SAS, smart, salesforce, Inspur soft
- Openpyxl drawing area map
- NFT mall /nft blind box / virtual blind box /nft transaction / customizable second opening
- 浪潮之巅——读书笔记+摘录+感悟
- US pressure surges tiktok changes global safety director
猜你喜欢

5V boost 9V chip

Julia beginner tutorial 2022

Self built personalized automatic quotation system to cope with changeable quotation mode

Shutter project scrollcontroller attached to multiple scroll views, failed assertion: line 109 POS 12 error handling

评价自动化测试优劣的隐性指标

Necessary foundation: Signature Verification

Implicit indicators for evaluating the advantages and disadvantages of automated testing

Good looking (dynamic) Jay fan self-made dynamic album card (front and back are different) and lyrics page

20210518-Cuda

CMD Chinese garbled code solution
随机推荐
CMD Chinese garbled code solution
I/o instance operation
Chapter 13 IO flow
Go Beginner (4)
Basic architecture of data Lake
2021-3-22-directed graph sorting
Chapter 8 multithreading
One article to understand the index of like in MySQL
The use of omitempty in go
Why does MySQL index use b+ tree instead of jump table?
Wechat applet session holding
Alibaba cloud RDS exception during pool initialization
MySQL paging query instance_ MySQL paging query example explanation "suggestions collection"
Go Introduction (2)
You haven't connected to the proxy server. There may be a problem or the address is incorrect (how to check the proxy server IP)
Set接口
20210519 leetcode double pointer
The bank's face recognition system was broken: a depositor was stolen 430000 yuan
Ali II: what if the AOF file in redis is too large?
硬刚甲方后:中国移动 4908 万大单被废