最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Redis數(shù)據(jù)遷移RedisShake的實(shí)現(xiàn)方法

 更新時(shí)間:2024年10月11日 11:22:18   作者:JAVA菜鳥程序員  
本文主要介紹了Redis數(shù)據(jù)遷移RedisShake的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

一、基本功能

redis-shake它支持解析、恢復(fù)、備份、同步四個(gè)功能

恢復(fù)restore:將RDB文件恢復(fù)到目的redis數(shù)據(jù)庫(kù)。

備份dump:將源redis的全量數(shù)據(jù)通過(guò)RDB文件備份起來(lái)。

解析decode:對(duì)RDB文件進(jìn)行讀取,并以json格式解析存儲(chǔ)。

同步sync:支持源redis和目的redis的數(shù)據(jù)同步,支持全量和增量數(shù)據(jù)的遷移,支持單節(jié)點(diǎn)、主從版、集群版之間的互相同步。

同步rump:支持源redis和目的redis的數(shù)據(jù)同步,僅支持全量的遷移,采用scan和restore命令進(jìn)行遷移,支持不同云廠商不同redis版本的遷移。

二、基本原理

三、RedisShake同步原理

1.源Redis服務(wù)實(shí)例相當(dāng)于主庫(kù),Redis-shake相當(dāng)于從庫(kù),它會(huì)發(fā)送psync指令給源Redis服務(wù)實(shí)例。

2.源Redis實(shí)例先把RDB文件傳輸給 Redis-shake ,Redis-shake 會(huì)把RDB文件發(fā)送給目的實(shí)例。

3.源實(shí)例會(huì)再把增量命令發(fā)送給 Redis-shake ,Redis-shake負(fù)責(zé)把這些增量命令再同步給目的實(shí)例。

四、RedisShake安裝

確保您在本地機(jī)器上設(shè)置了 Golang 環(huán)境。

4.1、release包下載

Releases · tair-opensource/RedisShake · GitHub

4.2、解壓

tar -zxvf redis-shake-linux-amd64.tar.gz -C /home/redisshake/

解壓完了之后有兩個(gè)文件:

4.3、修改shake.toml配置文件

function = ""


[sync_reader]
cluster = false            # set to true if source is a redis cluster
address = "127.0.0.1:6379" # when cluster is true, set address to one of the cluster node
username = ""              # keep empty if not using ACL
password = ""              # keep empty if no authentication is required
tls = false
sync_rdb = true # set to false if you don't want to sync rdb
sync_aof = true # set to false if you don't want to sync aof
prefer_replica = true # set to true if you want to sync from replica node

#[scan_reader]
#cluster = false            # set to true if source is a redis cluster
#address = "127.0.0.1:6379" # when cluster is true, set address to one of the cluster node
#username = ""              # keep empty if not using ACL
#password = ""              # keep empty if no authentication is required
#tls = false
#dbs = []                   # set you want to scan dbs such as [1,5,7], if you don't want to scan all
#scan = true                # set to false if you don't want to scan keys
#ksn = false                # set to true to enabled Redis keyspace notifications (KSN) subscription
#count = 1                  # number of keys to scan per iteration

# [rdb_reader]
# filepath = "/tmp/dump.rdb"

# [aof_reader]
# filepath = "/tmp/.aof"
# timestamp = 0              # subsecond

[redis_writer]
cluster = false            # set to true if target is a redis cluster
sentinel = false           # set to true if target is a redis sentinel
master = ""                # set to master name if target is a redis sentinel
address = "192.168.72.129:6379" # when cluster is true, set address to one of the cluster node
username = ""              # keep empty if not using ACL
password = ""              # keep empty if no authentication is required
tls = false
off_reply = false       # ture off the server reply

[advanced]
dir = "data"
ncpu = 0        # runtime.GOMAXPROCS, 0 means use runtime.NumCPU() cpu cores
pprof_port = 0  # pprof port, 0 means disable
status_port = 0 # status port, 0 means disable

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

# redis-shake gets key and value from rdb file, and uses RESTORE command to
# create the key in target redis. Redis RESTORE will return a "Target key name
# is busy" error when key already exists. You can use this configuration item
# to change the default behavior of restore:
# panic:   redis-shake will stop when meet "Target key name is busy" error.
# rewrite: redis-shake will replace the key with new value.
# ignore:  redis-shake will skip restore the key when meet "Target key name is busy" error.
rdb_restore_command_behavior = "panic" # panic, rewrite or skip

# redis-shake uses pipeline to improve sending performance.
# This item limits the maximum number of commands in a pipeline.
pipeline_count_limit = 1024

# Client query buffers accumulate new commands. They are limited to a fixed
# amount by default. This amount is normally 1gb.
target_redis_client_max_querybuf_len = 1024_000_000

# In the Redis protocol, bulk requests, that are, elements representing single
# strings, are normally limited to 512 mb.
target_redis_proto_max_bulk_len = 512_000_000

# If the source is Elasticache or MemoryDB, you can set this item.
aws_psync = "" # example: aws_psync = "10.0.0.1:6379@nmfu2sl5osync,10.0.0.1:6379@xhma21xfkssync"

# destination will delete itself entire database before fetching files
# from source during full synchronization.
# This option is similar redis replicas RDB diskless load option:
#   repl-diskless-load on-empty-db
empty_db_before_sync = false

[module]
# The data format for BF.LOADCHUNK is not compatible in different versions. v2.6.3 <=> 20603
target_mbbloom_version = 20603

官方使用指導(dǎo)手冊(cè):Sync Reader | RedisShake

4.4、啟動(dòng)RediShake

./redis-shake shake.toml

4.5、測(cè)試數(shù)據(jù)遷移

在192.168.72.128這臺(tái)機(jī)器上插入幾個(gè)key

可以看到RedisShake工具在實(shí)施監(jiān)聽(tīng)key,有新增的就會(huì)把新增的key遷移到另外一機(jī)器的redis中;看打印的日志是寫了4條數(shù)據(jù)

在192.168.72.129這臺(tái)機(jī)器上查看遷移的數(shù)據(jù)

4.6、數(shù)據(jù)校驗(yàn)

通過(guò)info keyspace命令,查看所有的key和過(guò)期key的數(shù)量。

到此這篇關(guān)于Redis數(shù)據(jù)遷移RedisShake的實(shí)現(xiàn)方法的文章就介紹到這了,更多相關(guān)Redis數(shù)據(jù)遷移RedisShake內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

  • Redis+AOP+自定義注解實(shí)現(xiàn)限流

    Redis+AOP+自定義注解實(shí)現(xiàn)限流

    這篇文章主要為大家詳細(xì)介紹了如何利用Redis+AOP+自定義注解實(shí)現(xiàn)個(gè)小功能:自定義攔截器限制訪問(wèn)次數(shù),也就是限流,感興趣的可以了解一下
    2022-06-06
  • Windows下Redis安裝配置教程

    Windows下Redis安裝配置教程

    這篇文章主要為大家詳細(xì)介紹了Windows下Redis安裝配置教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-11-11
  • 控制Redis的hash的field中的過(guò)期時(shí)間

    控制Redis的hash的field中的過(guò)期時(shí)間

    這篇文章主要介紹了控制Redis的hash的field中的過(guò)期時(shí)間問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-01-01
  • redis底層數(shù)據(jù)結(jié)構(gòu)之skiplist實(shí)現(xiàn)示例

    redis底層數(shù)據(jù)結(jié)構(gòu)之skiplist實(shí)現(xiàn)示例

    這篇文章主要為大家介紹了redis底層數(shù)據(jù)結(jié)構(gòu)之skiplist實(shí)現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-12-12
  • 淺談Redis主從復(fù)制以及主從復(fù)制原理

    淺談Redis主從復(fù)制以及主從復(fù)制原理

    在現(xiàn)有企業(yè)中80%公司大部分使用的是redis單機(jī)服務(wù),在實(shí)際的場(chǎng)景當(dāng)中單一節(jié)點(diǎn)的redis容易面臨風(fēng)險(xiǎn)。本文將介紹Redis主從復(fù)制以及主從復(fù)制原理。
    2021-05-05
  • Redis慢日志的實(shí)現(xiàn)示例

    Redis慢日志的實(shí)現(xiàn)示例

    慢查詢?nèi)罩臼荝edis提供的一個(gè)用于觀察系統(tǒng)性能的功能,本文主要介紹了Redis慢日志的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2024-04-04
  • Redis 跳表(Skip List)原理實(shí)現(xiàn)

    Redis 跳表(Skip List)原理實(shí)現(xiàn)

    跳表是zset有序集合的底層實(shí)現(xiàn)之一,本文主要介紹了Redis 跳表(Skip List)原理實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2025-04-04
  • Redis?HyperLogLog數(shù)據(jù)統(tǒng)計(jì)輕量級(jí)解決方案詳解

    Redis?HyperLogLog數(shù)據(jù)統(tǒng)計(jì)輕量級(jí)解決方案詳解

    這篇文章主要為大家介紹了Redis?HyperLogLog數(shù)據(jù)統(tǒng)計(jì)輕量級(jí)解決方案詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-12-12
  • Redis中緩存穿透/擊穿/雪崩問(wèn)題和解決方法

    Redis中緩存穿透/擊穿/雪崩問(wèn)題和解決方法

    大家好,本篇文章主要講的是Redis中緩存穿透/擊穿/雪崩問(wèn)題和解決方法,感興趣的同學(xué)趕快來(lái)看一看吧,對(duì)你有幫助的話記得收藏一下哦,方便下次瀏覽
    2021-12-12
  • redis啟動(dòng)和退出命令行簡(jiǎn)單操作步驟

    redis啟動(dòng)和退出命令行簡(jiǎn)單操作步驟

    Redis是一種鍵值存儲(chǔ)數(shù)據(jù)庫(kù),用戶可以使用它來(lái)存儲(chǔ)和檢索大量的鍵值數(shù)據(jù),下面這篇文章主要給大家介紹了關(guān)于redis啟動(dòng)和退出命令行的相關(guān)資料,需要的朋友可以參考下
    2024-03-03

最新評(píng)論

驻马店市| 上饶市| 肃南| 巴林左旗| 女性| 饶平县| 乐亭县| 武宁县| 彝良县| 濮阳市| 青神县| 交口县| 常山县| 嘉善县| 海林市| 云霄县| 灵璧县| 慈溪市| 临沭县| 双鸭山市| 新兴县| 五莲县| 弋阳县| 金门县| 南京市| 盱眙县| 汪清县| 红河县| 柘荣县| 保定市| 洱源县| 远安县| 财经| 安徽省| 宜兰县| 潜山县| 施甸县| 建瓯市| 安龙县| 新建县| 民县|