windows_mongodb_arbiter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
windows_mongodb_arbiter [2020/01/23 09:11] walkeradminwindows_mongodb_arbiter [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 10: Line 10:
 Availability and Redundancy. In this case, MongoDB uses a replica set.\\  Availability and Redundancy. In this case, MongoDB uses a replica set.\\ 
 \\  \\ 
-{{:mongo_diagram.png?600 |}}+{{ :mongo_diagram.png?400 |}}
 \\  \\ 
 A replica set is a group of mongod instances that maintain the same data set. A replica set contains A replica set is a group of mongod instances that maintain the same data set. A replica set contains
Line 18: Line 18:
 to maintain a quorum in a replica set by responding to heartbeat and election requests by other to maintain a quorum in a replica set by responding to heartbeat and election requests by other
 replica set members. replica set members.
 +\\  
 +\\  
 +---- 
 +===== Download MongoDB ===== 
 +\\  
 +Firstly we need to download MongoDB, this can be downloaded from [[https://www.mongodb.com/download-center/community?jmp=docs]] 
 +\\  
 +\\  
 +At the time of writing, we are using v3.6 which you can also get {{ :mongodb-win32-x86_64-2008plus-ssl-3.6.16-signed.zip |here}}. 
 +\\  
 +\\  
 +---- 
 +===== Install MongoDB ===== 
 +\\  
 +• Double-click the .MSI file and click Next 
 +\\  
 +\\  
 +• Accept the terms of the license agreement and click Next 
 +\\  
 +\\  
 +• Choose Complete Installation 
 +\\  
 +\\  
 +• Uncheck “Install MongoDB Compass” and click Next 
 +\\  
 +\\  
 +• Click Install 
 +\\  
 +\\  
 +• Click Finish to exit the Setup Wizard 
 +\\  
 +\\  
 +MongoDB will be installed in C:\Program Files\MongoDB\Server\3.6 
 +\\  
 +\\  
 +---- 
 +===== Configure MongoDB ===== 
 +\\  
 +Create a folder structure to contain the database files and logs. The MongoDB 
 +documentation uses C:\data but a more obvious name is C:\mongo 
 +\\  
 +    cd C:\ 
 +    mkdir "\mongo\db" "\mongo\log" 
 +\\  
 +Create a MongoDB configuration file "<color #00a2e8>C:\Program Files\MongoDB\Server\3.6\mongod.cfg</color>" 
 +\\  
 +<file> 
 +systemLog: 
 +  destination: "file" 
 +  path: "c:\\mongo\\log\\mongod.log" 
 +storage: 
 +  dbPath: "c:\\mongo\\db" 
 +replication: 
 +  replSetName: repldb 
 +security: 
 +  authorization: enabled 
 +  keyFile: "c:\\Program Files\\MongoDB\\Server\\3.6\\mongodb.key" 
 +  transitionToAuth: false 
 +net: 
 +  port: 27018 
 +  bindIp: 0.0.0.0 
 +</file> 
 +You can download the mongod.cfg file {{ :mongod.zip |here}}: 
 +\\  
 +\\  
 +Create a MongoDB key file: 
 +\\  
 +\\  
 +Create the file "C:\Program Files\MongoDB\Server\3.6\mongodb.key" 
 +\\  
 +\\  
 +The contents of the key file should be the same as the corresponding file on the 
 +Controller instances. This can be found using the following CentOS command: 
 +\\  
 +    cat /etc/ericsson/secrets/mongo/mongodb.key 
 +Just copy the mongodb.key file from your Controller to your Windows MongoDB folder (C:\Program Files\MongoDB\Server\3.6) 
 +---- 
 +\\  
 +===== Create a MongoDB Service ===== 
 +\\  
 +From a Windows Command Line, yype the following in Cmd.exe to create a MongoDB Service. 
 +\\  
 +    sc.exe create MongoDB binPath="\"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe\" --service --config=\"C:\Program Files\MongoDB\Server\3.6\mongod.cfg\"" DisplayName="MongoDB" start=auto 
 +\\  
 +Start the service with the following command: 
 +\\  
 +    net start MongoDB 
 +\\  
 +---- 
 +\\  
 +===== Add Arbiter to Replicaset ===== 
 +\\  
 +SSH (or console) to your 'PRIMARY' Controller (this will be the one that has the VIP IP). 
 +\\  
 +\\  
 +From the command line type <color #00a2e8>ip a</color> 
 +\\  
 +\\  
 +eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 
 +\\  
 +link/ether 74:fe:48:45:5a:52 brd ff:ff:ff:ff:ff:ff 
 +\\  
 +inet <color #ed1c24>10.43.30.17/24</color> brd 10.43.30.255 scope global noprefixroute eth0 
 +\\  
 + valid_lft forever preferred_lft forever 
 +\\  
 +inet <color #ed1c24>10.43.30.19/32</color> scope global eth0 
 +\\  
 + valid_lft forever preferred_lft forever 
 +\\  
 +inet <color #ed1c24>10.43.30.20/32</color> scope global eth0 
 +\\  
 + valid_lft forever preferred_lft forever 
 +\\  
 +inet6 fe80::76fe:48ff:fe45:5a52/64 scope link 
 +\\  
 + valid_lft forever preferred_lft forever 
 +\\  
 +\\  
 +If you see the three IP Addresses (Controller IP1, VIP, LicensingVIP) then you are on the PRIMARY controller. 
 +\\  
 +\\  
 +Check the password in the secrets.ini 
 +    cat /etc/ericsson/secrets/mongo/secrets.ini 
 +Now add the Arbiter details by using the following: 
 +    mongo admin -u MediaKind -p ********* 
 +\\  
 +\\  
 +Add the Arbiter using the rs.addArb method with the IP address of the Windows server that is used 
 +for the management network of the MediaKind appliances e.g. 
 +\\  
 +    repldb:PRIMARY> rs.addArb("x.x.x.x:27018"
 +     
 +    (where x.x.x.x is the Management IP Address of your nCompass Server) 
 +\\  
 +---- 
 +===== Verify Replicaset Members ===== 
 +\\  
 +Whilst in the mongo client, use the rs.status method to list the members of the Replicaset: 
 +    repldb:PRIMARY> rs.status() 
 +This should return information including details of the PRIMARY, SECONDARY and ARBITER nodes: 
 +<file> 
 +
 +        "set" : "repldb", 
 +        "date" : ISODate("2020-01-23T08:30:18.165Z"), 
 +        "myState" : 1, 
 +        "term" : NumberLong(1), 
 +        "syncingTo" : "", 
 +        "syncSourceHost" : "", 
 +        "syncSourceId" : -1, 
 +        "heartbeatIntervalMillis" : NumberLong(2000), 
 +        "optimes" : { 
 +                "lastCommittedOpTime" : { 
 +                        "ts" : Timestamp(1579768211, 2), 
 +                        "t" : NumberLong(1) 
 +                }, 
 +                "readConcernMajorityOpTime" : { 
 +                        "ts" : Timestamp(1579768211, 2), 
 +                        "t" : NumberLong(1) 
 +                }, 
 +                "appliedOpTime" : { 
 +                        "ts" : Timestamp(1579768211, 2), 
 +                        "t" : NumberLong(1) 
 +                }, 
 +                "durableOpTime" : { 
 +                        "ts" : Timestamp(1579768211, 2), 
 +                        "t" : NumberLong(1) 
 +                } 
 +        }, 
 +        "members" : [ 
 +                { 
 +                        "_id" : 0, 
 +                        "name" : "10.43.30.17:27017", 
 +                        "health" : 1, 
 +                        "state" : 1, 
 +                        "stateStr" : "PRIMARY", 
 +                        "uptime" : 64477, 
 +                        "optime" : { 
 +                                "ts" : Timestamp(1579768211, 2), 
 +                                "t" : NumberLong(1) 
 +                        }, 
 +                        "optimeDate" : ISODate("2020-01-23T08:30:11Z"), 
 +                        "syncingTo" : "", 
 +                        "syncSourceHost" : "", 
 +                        "syncSourceId" : -1, 
 +                        "infoMessage" : "", 
 +                        "electionTime" : Timestamp(1579703742, 2), 
 +                        "electionDate" : ISODate("2020-01-22T14:35:42Z"), 
 +                        "configVersion" : 3, 
 +                        "self" : true, 
 +                        "lastHeartbeatMessage" : "" 
 +                }, 
 +                { 
 +                        "_id" : 1, 
 +                        "name" : "10.43.30.18:27017", 
 +                        "health" : 1, 
 +                        "state" : 2, 
 +                        "stateStr" : "SECONDARY", 
 +                        "uptime" : 64308, 
 +                        "optime" : { 
 +                                "ts" : Timestamp(1579768211, 2), 
 +                                "t" : NumberLong(1) 
 +                        }, 
 +                        "optimeDurable" : { 
 +                                "ts" : Timestamp(1579768211, 2), 
 +                                "t" : NumberLong(1) 
 +                        }, 
 +                        "optimeDate" : ISODate("2020-01-23T08:30:11Z"), 
 +                        "optimeDurableDate" : ISODate("2020-01-23T08:30:11Z"), 
 +                        "lastHeartbeat" : ISODate("2020-01-23T08:30:17.980Z"), 
 +                        "lastHeartbeatRecv" : ISODate("2020-01-23T08:30:17.039Z"), 
 +                        "pingMs" : NumberLong(0), 
 +                        "lastHeartbeatMessage" : "", 
 +                        "syncingTo" : "10.43.30.17:27017", 
 +                        "syncSourceHost" : "10.43.30.17:27017", 
 +                        "syncSourceId" : 0, 
 +                        "infoMessage" : "", 
 +                        "configVersion" : 3 
 +                }, 
 +                { 
 +                        "_id" : 2, 
 +                        "name" : "10.43.30.21:27018", 
 +                        "health" : 1, 
 +                        "state" : 7, 
 +                        "stateStr" : "ARBITER", 
 +                        "uptime" : 22, 
 +                        "lastHeartbeat" : ISODate("2020-01-23T08:30:17.981Z"), 
 +                        "lastHeartbeatRecv" : ISODate("2020-01-23T08:30:18.084Z"), 
 +                        "pingMs" : NumberLong(1), 
 +                        "lastHeartbeatMessage" : "", 
 +                        "syncingTo" : "", 
 +                        "syncSourceHost" : "", 
 +                        "syncSourceId" : -1, 
 +                        "infoMessage" : "", 
 +                        "configVersion" : 3 
 +                } 
 +        ], 
 +        "ok" : 1, 
 +        "operationTime" : Timestamp(1579768211, 2), 
 +        "$clusterTime" : { 
 +                "clusterTime" : Timestamp(1579768215, 1), 
 +                "signature" : { 
 +                        "hash" : BinData(0,"TvImZ5m+/dag28UkRYCDcqrXlvk="), 
 +                        "keyId" : NumberLong("6784775917848756225"
 +                } 
 +        } 
 +
 +repldb:PRIMARY> exit 
 +</file>
windows_mongodb_arbiter.1579770696.txt.gz · Last modified: 2023/03/09 22:35 (external edit)