聊聊 Undermoo -为 Memory Broker 设置备份
2023-02-25 18:26:47 时间
项目地址:https://github.com/doyoubi/undermoon
为 Memory Broker 设置 Replica
构建二进制文件:
$ cargo build
运行 replica
$ 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
$ 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
现在系统应该能够再次工作。
相关文章
- 学生数据库管理系统
- SpringDataJpa 用MySQL语句怎么分页,spring全家桶SpringDataJpa 用MySQL语句怎么分页
- Docker创建MySQL容器模板命令
- Elasticsearch对应MySQL的对应关系
- 使用SpringDataJpa保存(save)报错误:SQL Error: 1062, SQLState: 23000 控制台会报:Duplicate entry ‘数‘ for key ‘PRIMA
- Navicat Premium 连接sqlserver数据库时提示安装Client失败,解决方案
- Mysql查询当前用户所有数据库语句(SHOW DATABASES)
- MySQL语句-查看当前数据库有哪些表(SHOW TABLES)
- MySQL5.0版本以上新增的 information_schema 数据库是什么?
- MariaDB数据库备份之逻辑备份
- MariaDB数据库创建用户
- MariaDB数据库给用户授权
- MariaDB数据库刷新权限表命令
- MariaDB数据库删除用户命令
- PhpStudy 2016搭建-sqli-libs靶场
- MySQL手动注入步骤
- Pikachu靶场-SQL注入-数字型注入(post)过关步骤
- Pikachu靶场-SQL注入-字符型注入(get)过关步骤
- 利用SQL注入漏洞实现MySQL数据库读写文件
- Kali-工具-sqlmap常见用法