Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The goal of this article is to describe the mongodb cluster that has been configured as the backend for peopledb3(peopledbv3). In the future, the goal is to use this for future apps that want/require a mongo backend database.

The following details are accurate as of November 6, 2018

nodes:

  • siomongo1.ucsd.edu
  • siomongo2.ucsd.edu
  • siomongo3.ucsd.edu

This trio of hosts are configured to operate as replica sets with one primary and (2) read-only replica sets. The primary goal of clustering here is for high-availability(HA), as the hosts vote for quorum on which host will serve as the master. Connection strings to this cluster should include all or a majority of nodes so that the HA functionality works as intended.


Troubleshooting:

siomongo1 was down for a few days, and it was too out-of-sync to rejoin the cluster. To fix this, remove all files from the database directory, /data/db and restart the mongod service. This will put the node into STARTUP & STARTUP2 status. Eventually, the node will rebuild, and be promoted to SECONDARY status

Warning

This should only be done on a single node, and the replication status should be checked first

Notes from bootstrapping the stage cluster

Check service status via ansible

Code Block
ansible mongodb_stage -m shell -a 'systemctl status rh-mongodb36-mongod'


Image Added


Check status of cluster replication

Code Block
 scl enable rh-mongodb36 "mongo -u root -p'**REDACTED**' --authenticationDatabase admin --eval 'rs.status()'"


Code Block
ansible mongodb_stage -m shell -a  "scl enable rh-mongodb36 $'mongo -u root -p \'REDACTED1P\' --authenticationDatabase admin --eval \'rs.status()\' '" 


Code Block
[root@siomongo1-stage ~]# scl enable rh-mongodb36 "mongo -u root -p'REDACTED1P' --quiet --authenticationDatabase admin --eval 'JSON.stringify(rs.status())'"  | jq '.'


Let's find the state of the cluster nodes and which one is primary

Code Block
scl enable rh-mongodb36 "mongo -u root -p'REDACTED' --quiet --authenticationDatabase admin --eval 'JSON.stringify(rs.status())'" \
| jq -C '.members[] | [.name, .stateStr]'


THIS ONE BELOW WORKS!!!!

Code Block
ansible siomongo1-stage.ucsd.edu -m shell -a  "scl enable rh-mongodb36 $'mongo -u root -p \'REDACTED1P\' --quiet --authenticationDatabase admin --eval \'JSON.stringify(rs.status())\' ' | jq '.members[] | [.name, .stateStr]'"


There are some in-progress scripts on root@clortho:~/mongo-scripts. The following ENV variable must be set to see output

Code Block
ANSIBLE_STDOUT_CALLBACK="minimal"



Info

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@a51
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "peopledb" , "high-availability" , "ha" , "mongo" , "nosql" , "database" , "cluster" , "peopledb3" , "replication" , "mongodb" ) and type = "page" and space = "SD"
labelspeopledb peopledb3 mongo mongodb nosql database cluster replication ha high-availability

...

Page Properties
hiddentrue


Related issues