User Tools

Site Tools


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:26] walkeradminwindows_mongodb_arbiter [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 58: Line 58:
 Create a folder structure to contain the database files and logs. The 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 documentation uses C:\data but a more obvious name is C:\mongo
-\\  
 \\  \\ 
     cd C:\     cd C:\
Line 64: Line 63:
 \\  \\ 
 Create a MongoDB configuration file "<color #00a2e8>C:\Program Files\MongoDB\Server\3.6\mongod.cfg</color>" Create a MongoDB configuration file "<color #00a2e8>C:\Program Files\MongoDB\Server\3.6\mongod.cfg</color>"
-\\  
 \\  \\ 
 <file> <file>
Line 82: Line 80:
   bindIp: 0.0.0.0   bindIp: 0.0.0.0
 </file> </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.1579771560.txt.gz · Last modified: 2023/03/09 22:35 (external edit)