MongoDB auto-update application with replica set

I am currently involved in providing our high availability applications.

Our applications have an automatic update function (using Mongeez), which ensures that the structure of all databases / collections / documents is in the correct format for this version of the application.

The problem is that it's hard for me to solve the problem of replication and version control.

I will use the following example to better explain the problem.

Example

I need to upgrade application X to application X2.0 on both servers without downtime, so I do the following:

  • Stop application X A
  • Install version 2.0 on server A
  • Launch X2.0 A Application
  • X2.0 A MongoDB 2.0
  • MongoDB Replica Set, MongoDB.
  • !!!... X B 1.0, 2.0 //.

? " "?

+4
1

, :

  • F1: 1.0
  • F2: 2.0
  • XA: F1
  • XB: , F2 ( 2.0)

F2 F1, XA XB . , , :)

F2 F1, .

=============== ==================

  • version ( F1 F2)
  • XB F1 & F2: F1, F1, F2, F2
  • XB (XA , F2 )
  • make XB F2: F1, F2, XB.
  • F1 F2

=============== , ===================

:

  • C1: F1
  • C2: F2
  • XB: : C1 C2. XA- C1.

:

  • XA , F1 C1
  • C1 C2 ( F1 F2)
  • oplog, , C1 C2
  • XB C1, C1 & C2 (!)
  • XB, XA , C1
  • XB C2
  • F1 XB

step2 step3 ().

, 2 3, XB .

=============== ==================

  • . : G1 (XA1, XA2), G2 (XA3, XA4)
  • nginx/haproxy .
  • G1 (XA1, XA2)
  • XB G2, : G2 (XB3, XB4)
  • G2 (XB3, XB4)
  • XB G1, : G1 (XB1, XB2)
  • G1 (XB1, XB2)/G2 (XB3, XB4)
  • F1 F2

:

  • 3/ 5 , .
  • XB, .
0

All Articles