Guest User

Untitled

a guest
Oct 17th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. // Stratege2:
  2. // 0. Init
  3. // 1. get local master record
  4. // 1. connection
  5. // 1. error -> 4.3. RedisError
  6. // 1. success -> 1.
  7. // 1. Who am I?
  8. // 1. local redis is master -> 2.
  9. // 2. local redis is slave -> 3.
  10. // 3. local redis status unknown -> 2.
  11. // 2. Master actions: confirm from other (round robin)
  12. // 1. other unreacheble -> 2.
  13. // 2. others master is me -> 4.4. (OK)
  14. // 3. others master is not me -> 4.2. (SetNewMaster)
  15. // 3. Slave actions (check master)
  16. // 1. master is dead -> 4.1. (ReSync)
  17. // 2. master is alive (cheking master records)
  18. // 1. LM==MM -> 4.4. (OK)
  19. // 2. LM!=MM -> 4.2. (SetNewMaster)
  20. // 4. Misc actions
  21. // 1. ReSync
  22. // 1. find next alive master (side-by-side selection)
  23. // 1. not found -> WOOT? even our local redis is dead -> 4.3. RedisError
  24. // 2. Push to others new master and setup replication
  25. // 2. SetNewMaster
  26. // 1. check new master status
  27. // 1. error -> 4.1. ReSync
  28. // 2. do work 4.1.2.
  29. // 3. RedisError
  30. // 1. throw HTTP 555 error code or throw exception (depends from environment)
  31. // 2. die
  32. // 4. OK
  33. // 1. do rediska setup
  34. // 2. let code-flow begin
Add Comment
Please, Sign In to add comment