Posts

Showing posts with the label mongod

MongoDB Log Switch Script

Image
It's been a while since I wrote a post, I have been busy exploring everything I want to learn outside of work and it's been fun. I think it's time to get back and document some more!  Today I want to talk about  log switching.  Having been managing MongoDB databases and MongoDB BI Connector for quite a while now. I can't put enough appreciation of how the logs have helped of making my life so much easier and they should be the one of the first things we check whenever we encounter any issue in regards to the aforementioned.  If you agree with me on how important the log is, please read on. Log is definitely your friend, but I know I had made the mistake of leaving it alone for a long while and when I truly needed it, it became a monster that I had to cut and dissect into workable size.  There was one time we had a production issue and I had to look into the issue immediately and of course I went straight to my friend, the logs. I tried looking into the log and t...

MongoDB: Change replica set name

This is just a quick reference guide for change the replica set name, for anyone who wish to give this a try, simply replace mongo-n to your own hostname, We will first find and kill the mongod processes running on each host then we will start them individually without the --replSet keyword, which simply means we will start each mongod as standalone database. They are started as follows: Note: if /etc/mongod.conf is used, simply remove --replSet in the config file and start mongod Node1: sudo -u mongodb mongod --port 27017 --dbpath /data/db --logpath /data/db/log/mongod.log --bind_ip localhost,mongo-1 --keyFile /etc/mongo.keyfile --fork Node2: sudo -u mongodb mongod --port 27017 --dbpath /data/db --logpath /data/db/log/mongod.log --bind_ip localhost,mongo-2 --keyFile /etc/mongo.keyfile --fork Node3: sudo -u mongodb mongod --port 27017 --dbpath /data/db --logpath /data/db/log/mongod.log --bind_ip localhost,mongo-3 --keyFile /etc/mongo.keyfile --fork Once all mongod...