Why do i have to first initiate CSRS file before my NODE can start successfully

Please, I have less than 24 hours fro this class, yet am still not getting somethings right. image

CSRS file image

NODE file image

MONGOS file image

I need to know what am not getting right here, I notice that all my configurations files only ran after running CSRS for it…am trying to understand their relationship.

Is this for a lab or lecture? What’s the name?

Is for a lab… I do not understand what is happening with my configuration files… or is there any way I can roll back and start afresh.

My last post to you in your former thread was about this same thing… if you recall. csrs4 to 6 are not a requirement for this lab. The only csrs config servers you need are these:

Nodes 4 to 6 are data bearing nodes, and not Config Servers.

The lab requires:

  1. Replica Set 1: Nodes 1, 2, 3
  2. Replica Set 2: Nodes 4, 5, 6
  3. Config Server: Nodes 1, 2, 3
  4. Mongos

Config Server: 1,2,3 and Replica Set 1: Nodes 1,2,3 starts properly, provided Config Server runs first.

After that , Replica Set 2: Nodes 4, 5, 6 will hang endlessly, same thing we treated since yesterday, I actually had to run CSRS 4-6 for them to work before… but delete the CSRS 4,5,6 since is not needed…but am back to the issue of waiting until server is ready for connections.
When i run ps -ef | grep [m]ongod , the result is show below.

Login to the primary node for csrs1 to 3 and let’s see the outputs for rs.isMaster() and rs.status().

In any case, I think if you shutdown all the csrs nodes, delete all the csrs data files and restart csrs1 to 3, it should be fine. Also kill the two node4 you have in the process list.



I was talking about the Config Server, that’s what csrs is in this lab.



Taken a look at what i have in my /var/mongodb/db/

I do not know if any of those CSRS(4,5,6), could be part of my problem…trying to delete, am getting a message that the file is not empty, so i could not delete.

Use rm -r instead of rmdir. But first, have you shutdown the nodes in the proper way?

I have removed those files, yet the issue still persist,

Replica Set 1: Nodes 1,2,3 starts successfully
Replica Set 2: Nodes 1,2,3 keeps hanging( waiting until server is ready for connections)
Config Server: Nodes 1, 2, 3 starts successfully
Mongos: starts successfully

Login to mongos and let’s see sh.status(). And kill node4.

sh.status() in mongos

I would suggest that you start from scratch. And also suggest that you double check all your config files to make sure you don’t have overlapping ports or directories, basically ensure that all the options and lines in all configuration files are correct.

To start with a clean slate, suggest the following steps:

  1. Destroy, re-provision and login to the VM
    vagrant destroy
    vagrant up
    vagrant ssh
    NB: when you run destroy, you need to confirm with a y
  2. Create all relevant parent and sub directories, give vagrant ownership to parent dir, and create keyfile. Copy, paste and execute the entire block of code in one go:
    sudo mkdir -p /var/mongodb/pki/
    sudo chown -R vagrant:vagrant /var/mongodb/
    mkdir -p /var/mongodb/db/{1,2,3,4,5,6}
    mkdir -p /var/mongodb/db/csrs{1,2,3}
    openssl rand -base64 741 > /var/mongodb/pki/m103-keyfile
    chmod 400 /var/mongodb/pki/m103-keyfile

Now you can start to build your replica sets. As a reminder:

  • Build nodes 1,2,3 as data bearing Replica Set 1
  • Build nodes 4,5,6 as data bearing Replica Set 2
  • Build nodes 1,2,3 as Cluster Server replica set
  • Run mongos, check sh.status() to make sure the config is linked, add shards RS1 and RS2

Remember to double check all your config files.

Double check each step to ensure that your replica sets have been built before moving on to the next step. Use rs.isMaster() and rs.status() as you go along.

Thanks so much, i start it again from scratch and i was able to get it right…thanks

Good to know!

Just to confirm, was there anything wrong with any of your config files or it was all ok?