当前位置: 首页 > news >正文

Redis数据同步

文章简单介绍基于redis-shake的redis数据同步,该工具基于每个节点同步数据,即每个主节点需同步一次,才能完成整个redis集群的数据同步。

1、redis节点操作

### 查看redis版本
./bin/redis-server --version### 登录redis
./bin/redis-cli -c -h *.*.*.142 -p 17001 -a '******'### 查看数据量
> info keyspace### 批量删除keys
./bin/redis-cli  -c -h *.*.*.142 -p 17001 -a '******' keys  "*@_@*"  | xargs -r -t -n1 ./bin/redis-cli -c -h *.*.*.142 -p 17001 -a '******' del./bin/redis-cli  -c -h *.*.*.144 -p 17001 -a '******' keys  "auth-dw*"  | xargs -r -t -n1 ./bin/redis-cli -c -h *.*.*.144 -p 17001 -a '******' del### 删除所有keys
> flushall### 查看set类型变量的内容
smembers "auth-ds:446fc...@24cfd7b0..."

2、redis-shake 配置与启动

编辑配置文件 vim ./sync.toml
type = "sync"[source]
version = 7.0 # redis version, such as 2.8, 4.0, 5.0, 6.0, 6.2, 7.0, ...
address = "*.*.*.93:17001"
username = "" # keep empty if not using ACL
password = "******" # keep empty if no authentication is required
tls = false
elasticache_psync = "" # using when source is ElastiCache. ref: https://github.com/alibaba/RedisShake/issues/373[target]
type = "standalone" # "standalone" or "cluster"  
version = 7.0 # redis version, such as 2.8, 4.0, 5.0, 6.0, 6.2, 7.0, ...# When the target is a cluster, write the address of one of the nodes.# redis-shake will obtain other nodes through the `cluster nodes` command.address = "*.*.*.142:17001"
username = "" # keep empty if not using ACL
password = "******" # keep empty if no authentication is required
tls = false[advanced]
dir = "data"ncpu = 4 # runtime.GOMAXPROCS, 0 means use runtime.NumCPU() cpu corespprof_port = 0 # pprof port, 0 means disablemetrics_port = 0 # metric port, 0 means disablelog_file = "redis-shake.log"
log_level = "info" # debug, info or warn
log_interval = 5 # in secondsrdb_restore_command_behavior = "skip" # panic, rewrite or skippipeline_count_limit = 1024 # pipelinetarget_redis_client_max_querybuf_len = 1024_000_000target_redis_proto_max_bulk_len = 512_000_000
启动redis-shake同步数据
nohup ./redis-shake sync.toml 1>> redis-shake.log 2>> redis-shake.log &
http://www.lryc.cn/news/398028.html

相关文章:

  • 快手矩阵源码,快速拥有自己的短视频矩阵
  • notes for datawhale 2th summer camp NLP task1
  • 攻防世界(PHP过滤器过滤)file_include
  • PostGIS2.4服务器编译安装
  • 虚拟机安装Linux CENTOS 07 部署NET8 踩坑大全
  • 【C++】CMake入门
  • 云WAF | 云waf保护你的网络安全
  • c++初阶知识——类和对象(1)
  • Vue 3 组件通信全解:从基础到高级技巧
  • 大众汽车入职SHL在线测评、英语口语、招聘笔试如何通过、考点分析|备考建议
  • 《植物大战僵尸杂交版》2.2:新版本体验与下载指南
  • 7月11日学习打卡,数据结构栈
  • 数据结构第20节 快速排序以及优化
  • 3分钟理解超键、候选键、主键
  • Centos忘记密码,重置root密码
  • Android初学者书籍推荐
  • 安卓文件上传照片单张及多张照片上传实现
  • 小白学webgl合集-import.meta.url 和 new URL() bug
  • pico+unity3d开启彩色透视
  • python常用命令
  • 使用定时器消除抖动
  • IOS热门面试题一
  • 构建LangChain应用程序的示例代码:62、如何使用Oracle AI向量搜索和Langchain构建端到端的RAG(检索增强生成)pipeline
  • ffmpeg转换MP4为gif命令
  • kotlin Flow 学习指南 (三)最终篇
  • Memcached负载均衡:揭秘高效缓存分发策略
  • 【Python实战因果推断】31_双重差分2
  • ArcGIS中使用线快速构造成面的方法
  • Spring AOP的几种实现方式
  • 字节码编程bytebuddy之实现抽象类并并添加自定义注解