惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 风雨行者

使用 Qjx.CustomCache 在接口进行AOP 数据缓存 asp.net core 基于autofac 实现AOP 拦截 之 第三种方式 -基于class asp.net core 基于autofac 实现AOP 拦截 之 第二种方式 -基于class asp.net core 3.1 应用Aufac 进行AOP 的三种方式1 基于接口AOP linux之 tomcat 安装配置入门 linux的nginx的安装以及负载均衡 linux 系统管理 linux 服务管理 Redis 集群部署之Redis 安装(1) hbuilder 运行在 android 模拟器中 asp.net digest 摘要认证过程 转载:Spring Boot 不使用默认的 parent,改用自己的项目的 paren .NET Core CLI 的性能诊断介绍 转载学习:windows下将ES和kibana作为服务启动 转(以作记录):cmd命令行---进行Windows服务操作 在 .NET Core 中使用 Diagnostics MyEclipse 使用外部tomcat 调试springboot Git与GitHub 学习笔记 dropdownlist 支持键盘拼音定位选择
redis主从复制 读写分离
风雨行者 · 2020-09-04 · via 博客园 - 风雨行者
  1. Redis 安装完毕后,创建两个文件夹redis7000 redis7100,其中redis7000 作为主,redis7100作为从

  2. 复制redisserver redis.conf到对应文件夹下命令如下

 

 

3.配置master

   转到master 目录下

   运行 vi redis.conf

   修改端口 port 7000

  修改密码  requirepass 123456

修改为守护进程启动 daemonize yes

 

 4.配置slave

修改为守护进程启动 daemonize yes

 

5启动主,启动从

进入到 redis7000目录 执行:redis-server redis.conf  

进入到 redis7100目录 执行:redis-server redis.conf

6查看进程

运行 ps -ef |grep redis

 

 7连接主

转到redis 原安装目录(src)下,找到redis-cli

执行命令:redis-cli -p 7000

输入 auth 123456 连接上redis

存储一个key

 

8连接从查看数据

  

9配置哨兵,切换主从

将哨兵配置文件 sentinel.conf copymaster slave文件夹下

命令如下:

 

  1. 编辑master哨兵文件

Vi sentinel.conf

port 27000

 sentinel monitor mymaster 127.0.0.1 7000 2

 sentinel auth-pass mymaster 123456
daemonize yes

  1. 编辑slave哨兵文件

首先转到redis7100目录

运行 vi sentinel.conf

编辑如下信息

port 27100

  sentinel monitor mymaster 127.0.0.1 7000 2

 sentinel auth-pass mymaster 123456
daemonize yes

10运行哨兵

分别转到 redis7000 redis7100目录运行以下命令

redis-server sentinel.conf --sentinelss

11查看进程

 

12验证主从切换功能

关闭master执行命令 kill -9 1434(pid)

这时原来的7100从库升级为主库,就可以进行读写了,之前只能读不能写

这里的主要问题就是在客户端编程的时候还需要进行特殊控制引用哨兵类