您现在的位置是:亿华云 > IT科技类资讯

聊聊 Undermoo -为 Memory Broker 设置备份

亿华云2025-10-03 06:59:03【IT科技类资讯】2人已围观

简介项目地址:https://github.com/doyoubi/undermoon为 Memory Broker 设置 Replica构建二进制文件:$ cargo build运行 replica$

项目地址:https://github.com/doyoubi/undermoon

为 Memory Broker 设置 Replica

构建二进制文件:

聊聊 Undermoo -为 Memory Broker 设置备份

$ cargo build

运行 replica

聊聊 Undermoo -为 Memory Broker 设置备份

$ RUST_LOG=warp=info,聊聊undermoon=info,mem_broker=info UNDERMOON_ADDRESS=127.0.0.1:8899 UNDERMOON_META_FILENAME=metadata2 target/debug/mem_broker

运行 master Memory

聊聊 Undermoo -为 Memory Broker 设置备份

$ RUST_LOG=warp=info,undermoon=info,mem_broker=info UNDERMOON_REPLICA_ADDRESSES=127.0.0.1:8899 UNDERMOON_SYNC_META_INTERVAL=3 target/debug/mem_broker

# Put some data to the master:

$ ./examples/mem-broker/init.sh

# Verify that on master:

curl localhost:7799/api/v3/metadata

...

# Verify tat on replica after 3 seconds:

curl localhost:7799/api/v3/metadata

...

# Replica should have the same data as master.

请注意,当 master 失败时,置备整个系统将 不会 自动故障回退到 replica。聊聊你需要通过调用 coordinator 的置备 API 来实现。在此期间,聊聊服务器代理仍然能够处理请求,置备但整个系统无法为服务器代理扩展和故障转移,聊聊直到 coordinator 的源码下载置备 Memory Broker 端点切换到 replica。

假设您已经运行了一个 coordinator:

$ RUST_LOG=undermoon=info,聊聊coordinator=info target/debug/coordinator conf/coordinator.toml

然后,您可以通过连接到 Redis 协议中的置备 coordinator 并更改配置来将 master 更改为 replica。

# 6699 is 聊聊the port of coordinators.

$ redis-cli -p 6699 CONFIG SET brokers 127.0.0.1:8899

主 memory broker 的最新 metadata 还没有被复制到 replica memory broker,因此失败了。置备我们不能恢复丢失的服务器租用聊聊数据,但是置备我们可以通过从所有记录的代理中收集 epoch 来增加元数据 epoch 以恢复服务。

所以我们也需要在重新配置 coordinator 后调用这个 API。聊聊

$ curl -XPUT localhost:7799/api/v3/epoch/recovery

现在系统应该能够再次工作。

很赞哦!(43)