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 cores

pprof_port = 0 # pprof port, 0 means disable

metrics_port = 0 # metric port, 0 means disable

log_file = "redis-shake.log"
log_level = "info" # debug, info or warn
log_interval = 5 # in seconds

rdb_restore_command_behavior = "skip" # panic, rewrite or skip

pipeline_count_limit = 1024 # pipeline

target_redis_client_max_querybuf_len = 1024_000_000

target_redis_proto_max_bulk_len = 512_000_000
启动redis-shake同步数据
nohup ./redis-shake sync.toml 1>> redis-shake.log 2>> redis-shake.log &

相关推荐

  1. Redis数据同步

    2024-07-12 01:16:02       26 阅读
  2. redis数据库同步问题

    2024-07-12 01:16:02       54 阅读
  3. redis缓存与数据库同步策略

    2024-07-12 01:16:02       48 阅读
  4. redis 如何保证数据同步数据变化时)

    2024-07-12 01:16:02       34 阅读
  5. C#+datax实现sql server数据同步redis

    2024-07-12 01:16:02       41 阅读
  6. Redis主从同步

    2024-07-12 01:16:02       33 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 01:16:02       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 01:16:02       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 01:16:02       57 阅读
  4. Python语言-面向对象

    2024-07-12 01:16:02       68 阅读

热门阅读

  1. 11、中台-DDD-几种微服务架构模型对比分析

    2024-07-12 01:16:02       23 阅读
  2. shark云原生-日志体系-ECK

    2024-07-12 01:16:02       20 阅读
  3. 9. 机器人数目

    2024-07-12 01:16:02       20 阅读
  4. Mysql-索引应用

    2024-07-12 01:16:02       22 阅读
  5. 【LeetCode】最长连续序列

    2024-07-12 01:16:02       25 阅读
  6. 游戏开发面试题1

    2024-07-12 01:16:02       20 阅读
  7. 一篇文章Scala语言入门

    2024-07-12 01:16:02       24 阅读
  8. html的浮动作用详解

    2024-07-12 01:16:02       23 阅读
  9. Perl语法作用域:深入探索变量的隐秘世界

    2024-07-12 01:16:02       22 阅读
  10. C#——Array类详情

    2024-07-12 01:16:02       26 阅读
  11. [202406] 一级 填空题 1~8题 答案解析

    2024-07-12 01:16:02       22 阅读
  12. 动态模型管理:Mojo模型的自定义保存与加载控制

    2024-07-12 01:16:02       23 阅读
  13. nginx-----web服务器

    2024-07-12 01:16:02       23 阅读
  14. Vue笔记10-其它Composition API

    2024-07-12 01:16:02       23 阅读