!"#$%&'()*+'*,+!"#$%&'+-"./+


   01%23.+4"55%6'*+78,6"559+
            :;2"*+
           <6)*2)=5+
>"*"5'$+?3%$)/)#3@+
•  -3'5,%*2+=)5+-&'$"ABC.+
•  !"#$%&'()*+=)5+DE+




•  F%.3+.3"+)&&'/%)*'$+"G&"#()*+
  –  -6'$$+,'.'+...
I'/%&/+
•  E+J%.+$%K"+4@-LM+5"#$%&'()*+
  –  E/@*&35)*)C/+6'/."5N/$'O"+
  –  M".P/+.5@+%.Q+
R)66'*,+M%*"+
•  AA6'/."5+SAA)#$)2-%T"+U4IVW+
•  AA/$'O"+X/)C5&"+U3)/.V+SAA)*$@+U,JVW+
Y3"+$)&'$+,J+
•  0)"/*P.+5"#$%&'."+
•  B*+6'/."5Z+
   –  $)&'$[)#$)2[6'%*+
   –  $)&'$[/$'O"/+
•  B*+/$'O"Z+
   –  $)&'$[/...
E,6%*%/.5'()*+
>   // master
>   use local
>   db.printReplicationInfo()
>   db.slaves.find()
>   db.oplog.$main.findOne()...
Y)#)$)2%"/+
M->S

M->S
 ->S
 ->S

M->S(db1)
 ->S(db2)
 …

M->S
 ->delayed_S

M->S               one machine can back up ma...
!"#$%&'+-"./+
• +>"*"5'$%T"H+%6#5)O"H+'*,+5"#$'&"+!"#$%&'+?'%5/+
• +E+&$C/."5+)=+]+/"5O"5/+
• +E*@+7)*"9+*),"+&'*+J"+#5%6'...
!"#$%&'+-"./+X+0"/%2*+R)*&"#./+
:[  E+15%."+%/+)*$@+.5C$@+&)66%c",+)*&"+%.+3'/+5"#$%&'.",+
    .)+'+6'd)5%.@+)=+/"5O"5/+%*...
E+-".+

4"6J"5+:+
                        4"6J"5+e+




            4"6J"5+b+
E+-".+

4"6J"5+:+
                        4"6J"5+e+




            4"6J"5+b+
            ?!^4E!f+
E+-".+

4"6J"5+:+
                        4"6J"5+e+
                        ?!^4E!f+




            4"6J"5+b+
           ...
E+-".+

4"6J"5+:+
                        4"6J"5+e+
                        ?!^4E!f+




            4"6J"5+b+
           ...
E+-".+

4"6J"5+:+
                        4"6J"5+e+
                        ?!^4E!f+




            4"6J"5+b+
R)*h2C5'()*+
{
    _id : <setname>,

    members: [
       {
         _id : <ordinal>,
         host : <hostname[:port]>,
...
^*%('()*+
> cfg = {
... _id : "acme_a",
... members : [
... { _id : 0, host : "sf1.acme.com" },
... { _id : 1, host : "sf2...
R)66'*,/+
!"#$%&$'()"*"+","
   +R3"&K/+%=+.3"+*),"+.)+13%&3+1"+'5"+&)**"&(*2+%/+&C55"*.$@+#5%6'5@[+
    4)/.+,5%O"5/+,)+.3...
-".+4"6J"5+Y@#"/+
•  ])56'$+
•  o0!p+7#5%)5%.@+U+:[;9+
   –  Y@#%&'$$@+,%/.'*.+$)&'()*+)5+/6'$$"5+3'5,1'5"+
•  ?'//%O"+7#5...
F%.3+-3'5,%*2+
0)&/Z+111[6)*2),J[)52N,%/#$'@N0BR-N!"#$%&'r-"./+



            LC"/()*/m+

453"&#(1#0(,(&3#6#(&#72,+8"#9#:;<;#6#".%(=#21>...
Upcoming SlideShare
Loading in...5
×

Replica Sets

9,766

Published on

Published in: Technology, Business
0 Comments
15 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,766
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
187
Comments
0
Likes
15
Embeds 0
No embeds

No notes for slide

Replica Sets

  1. 1. !"#$%&'()*+'*,+!"#$%&'+-"./+ 01%23.+4"55%6'*+78,6"559+ :;2"*+ <6)*2)=5+
  2. 2. >"*"5'$+?3%$)/)#3@+ •  -3'5,%*2+=)5+-&'$"ABC.+ •  !"#$%&'()*+=)5+DE+ •  F%.3+.3"+)&&'/%)*'$+"G&"#()*+ –  -6'$$+,'.'+/".H+6)/.$@+5"',/+
  3. 3. I'/%&/+ •  E+J%.+$%K"+4@-LM+5"#$%&'()*+ –  E/@*&35)*)C/+6'/."5N/$'O"+ –  M".P/+.5@+%.Q+
  4. 4. R)66'*,+M%*"+ •  AA6'/."5+SAA)#$)2-%T"+U4IVW+ •  AA/$'O"+X/)C5&"+U3)/.V+SAA)*$@+U,JVW+
  5. 5. Y3"+$)&'$+,J+ •  0)"/*P.+5"#$%&'."+ •  B*+6'/."5Z+ –  $)&'$[)#$)2[6'%*+ –  $)&'$[/$'O"/+ •  B*+/$'O"Z+ –  $)&'$[/)C5&"/+ > use local > db.sources.find()
  6. 6. E,6%*%/.5'()*+ > // master > use local > db.printReplicationInfo() > db.slaves.find() > db.oplog.$main.findOne() // slave > use local > db.printSlaveReplicationInfo()
  7. 7. Y)#)$)2%"/+ M->S M->S ->S ->S M->S(db1) ->S(db2) … M->S ->delayed_S M->S one machine can back up many M-/ (if it has enough resources) M<->M *very limited – best for experiments And Replica Sets (see below)
  8. 8. !"#$%&'+-"./+ • +>"*"5'$%T"H+%6#5)O"H+'*,+5"#$'&"+!"#$%&'+?'%5/+ • +E+&$C/."5+)=+]+/"5O"5/+ • +E*@+7)*"9+*),"+&'*+J"+#5%6'5@+ • +R)*/"*/C/+"$"&()*+)=+#5%6'5@+ • +EC.)6'(&+='%$)O"5+ • +EC.)6'(&+5"&)O"5@+ • +E$$+15%."/+.)+#5%6'5@+ • +!"',/+&'*+J"+.)+#5%6'5@+)5+'+/"&)*,+ • +0'.'+&"*."5+'1'5"+ • +^*+O:[_+7`YE+aC$@+b;:;9+
  9. 9. !"#$%&'+-"./+X+0"/%2*+R)*&"#./+ :[  E+15%."+%/+)*$@+.5C$@+&)66%c",+)*&"+%.+3'/+5"#$%&'.",+ .)+'+6'd)5%.@+)=+/"5O"5/+%*+.3"+/".[++7!"#$%&#'%()#*+,# $+&-,.%/+&#+*#)0(1#)0+230H+1%.3+2".M'/.`55)5[9+ b[  F5%."/+13%&3+'5"+&)66%c",+'.+.3"+6'/."5+)=+.3"+/".+ 6'@+J"+O%/%J$"+J"=)5"+.3"+.5C"+&$C/."5A1%,"+&)66%.+ 3'/+)&&C55",[++Y3%/+#5)#"5.@H+13%&3+%/+6)5"+5"$'G",+ .3'*+/)6"+.5',%()*'$+#5),C&./H+6'K"/+.3")5"(&'$$@+ '&3%"O'J$"+#"5=)56'*&"+'*,+'O'%$'J%$%.@+3%23"5[+ e[  B*+'+='%$)O"5H+%=+.3"5"+%/+,'.'+13%&3+3'/+*).+5"#$%&'.",+ =5)6+.3"+#5%6'5@H+.3"+,'.'+%/+,5)##",+7/""+<:9[+
  10. 10. E+-".+ 4"6J"5+:+ 4"6J"5+e+ 4"6J"5+b+
  11. 11. E+-".+ 4"6J"5+:+ 4"6J"5+e+ 4"6J"5+b+ ?!^4E!f+
  12. 12. E+-".+ 4"6J"5+:+ 4"6J"5+e+ ?!^4E!f+ 4"6J"5+b+ 0BF]+
  13. 13. E+-".+ 4"6J"5+:+ 4"6J"5+e+ ?!^4E!f+ 4"6J"5+b+ !`RBg`!A ^]>+
  14. 14. E+-".+ 4"6J"5+:+ 4"6J"5+e+ ?!^4E!f+ 4"6J"5+b+
  15. 15. R)*h2C5'()*+ { _id : <setname>, members: [ { _id : <ordinal>, host : <hostname[:port]>, [, priority: <priority>] [, arbiterOnly : true] [, votes : n] [, delay : time] } , ... ], settings: { [heartbeatSleep : <seconds>] [, heartbeatTimeout : <seconds>] [, heartbeatConnRetries : <n>] [, getLastErrorDefaults: <lasterrdefaults>] } }
  16. 16. ^*%('()*+ > cfg = { ... _id : "acme_a", ... members : [ ... { _id : 0, host : "sf1.acme.com" }, ... { _id : 1, host : "sf2.acme.com" }, ... { _id : 2, host : "sf3.acme.com" } ] } > use admin > db.runCommand({replSetInitiate:cfg})
  17. 17. R)66'*,/+ !"#$%&$'()"*"+"," +R3"&K/+%=+.3"+*),"+.)+13%&3+1"+'5"+&)**"&(*2+%/+&C55"*.$@+#5%6'5@[+ 4)/.+,5%O"5/+,)+.3%/+&3"&K+'C.)6'(&'$$@+'*,+.3"*+/"*,+5"iC%5"/+.)+ .3"+&C55"*.+#5%6'5@[+ !")(-./('0('/'&'1$"*"+"," +-.'.C/+%*=)56'()*+)*+.3"+5"#$%&'+/".+=5)6+.3%/+*),"j/+#)%*.+)=+O%"1[+ +3c#ZNN$)&'$3)/.Zbk;:lN5"#$-".>".-.'.C/m."G.+ !")(-./('23#4&'("*"567389:"," +^*%('."+'+5"#$%&'+/".[++ !")(-./(';)((<("*"5=77.:"," +n5""T%*2+'+5"#$%&'+/".+#5"O"*./+='%$)O"5/+=5)6+)&&C55%*2[+Y3%/+&'*+J"+ C/"=C$+,C5%*2+6'%*."*'*&"[+
  18. 18. -".+4"6J"5+Y@#"/+ •  ])56'$+ •  o0!p+7#5%)5%.@+U+:[;9+ –  Y@#%&'$$@+,%/.'*.+$)&'()*+)5+/6'$$"5+3'5,1'5"+ •  ?'//%O"+7#5%)5%.@+qq+;9+ •  E5J%."5+7*)+,'.'H+JC.+&'*+O)."9+
  19. 19. F%.3+-3'5,%*2+
  20. 20. 0)&/Z+111[6)*2),J[)52N,%/#$'@N0BR-N!"#$%&'r-"./+ LC"/()*/m+ 453"&#(1#0(,(&3#6#(&#72,+8"#9#:;<;#6#".%(=#21># ?'(30)@453"&;$+.# ]"G.+/"//%)*Z+ +EC.)A/3'5,%*2+ s#/.'%5/Z+ +D'&K+/"//%)*+
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×