RedisGraph多活设计方案功能测试

2022-07-21 08:23:58 浏览数 (1)

该文档主要是针对RedisGraph多活设计方案的功能测试,来说明方案是可实施是可行的。

该方案设计文档参见上一篇文章 RedisGraph图形数据库多活设计方案

  • 功能测试准备条件
  • RedisGraph的一主两从三哨兵的环境准备
  • 该次主要是高可用的功能测试
  • 资源规划
  • 打开哨兵
代码语言:javascript复制
docker exec -it dc1d79b6977f /bin/bash
redis-cli -p 26379
  • 执行查看主节点信息
代码语言:javascript复制
sentinel master mymaster
  • 查看从节点信息
代码语言:javascript复制
sentinel slaves mymaster
代码语言:javascript复制
1)  1) "name"
    2) "172.25.0.4:6380"
    3) "ip"
    4) "172.25.0.4"
    5) "port"
    6) "6380"
    7) "runid"
    8) "44df8f11fb77d388e9f7dc83ab626c592a5a256d"
    9) "flags"
   10) "slave"
   11) "link-pending-commands"
   12) "0"
   13) "link-refcount"
   14) "1"
   15) "last-ping-sent"
   16) "0"
   17) "last-ok-ping-reply"
   18) "287"
   19) "last-ping-reply"
   20) "287"
   21) "down-after-milliseconds"
   22) "60000"
   23) "info-refresh"
   24) "8834"
   25) "role-reported"
   26) "slave"
   27) "role-reported-time"
   28) "510641"
   29) "master-link-down-time"
   30) "0"
   31) "master-link-status"
   32) "ok"
   33) "master-host"
   34) "redisgraph-master"
   35) "master-port"
   36) "6379"
   37) "slave-priority"
   38) "100"
   39) "slave-repl-offset"
   40) "100353"
   41) "replica-announced"
   42) "1"
2)  1) "name"
    2) "172.25.0.3:6381"
    3) "ip"
    4) "172.25.0.3"
    5) "port"
    6) "6381"
    7) "runid"
    8) "6baf5539d0430f737004c10afd0753722222c597"
    9) "flags"
   10) "slave"
   11) "link-pending-commands"
   12) "0"
   13) "link-refcount"
   14) "1"
   15) "last-ping-sent"
   16) "0"
   17) "last-ok-ping-reply"
   18) "287"
   19) "last-ping-reply"
   20) "287"
   21) "down-after-milliseconds"
   22) "60000"
   23) "info-refresh"
   24) "8834"
   25) "role-reported"
   26) "slave"
   27) "role-reported-time"
   28) "510682"
   29) "master-link-down-time"
   30) "0"
   31) "master-link-status"
   32) "ok"
   33) "master-host"
   34) "redisgraph-master"
   35) "master-port"
   36) "6379"
   37) "slave-priority"
   38) "100"
   39) "slave-repl-offset"
   40) "100353"
   41) "replica-announced"
   42) "1"
  • 模拟主节点宕机
代码语言:javascript复制
docker-compose stop
redisgraph-master
  • 查看主节点信息
代码语言:javascript复制
127.0.0.1:26379> SENTINEL get-master-addr-by-name mymaster
  • 主节点已经发生转移
  • 把宕机的主机点启动
代码语言:javascript复制
docker-compose start redisgraph-master
  • 查看当前主节点信息
代码语言:javascript复制
127.0.0.1:26379> SENTINEL get-master-addr-by-name mymaster
  • 当宕机的节点启动时,不影响当前已经选举的主节点
  • 查看主节点信息
代码语言:javascript复制
info replication 
  • 可以看到以前的主节点(172.25.0.2)转移为从节点
  • 功能测试
  • 创建
代码语言:javascript复制
127.0.0.1:6380> GRAPH.QUERY MotoGP "CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}), (:Rider {name:'Dani Pedrosa'})-[:rides]->(:Team {name:'Honda'}), (:Rider {name:'Andrea Dovizioso'})-[:rides]->(:Team {name:'Ducati'})"
  • 查询
代码语言:javascript复制
127.0.0.1:6380> GRAPH.QUERY MotoGP "MATCH (r:Rider)-[:rides]->(t:Team) WHERE t.name = 'Yamaha' RETURN r.name, t.name"

记得给个关注,沟通不迷路

0 人点赞