Ok, last week a user here had an issue in which they restarted their server and after restart of server - mongodb would not connect to port 27017 - when attempting to run Chat+. Well, the other day, I had a power outage, and upon power restoration and starting server - I too ran into an issue where MongoDB could not connect to port 27017.
So - here are a few quick pointers. First off, I am using Centos 7 so all my notes are for that OS.
if for any reason you need to stop/restart your server - you should stop the Chat+ from running.
pidof node (this will list the process id of node)
kill -9 xxxxx (the xxxxx is the process id listed from command above)
service mongod stop
then you should be okay to stop/restart your server
If by chance you have a power outage like I did and are unable to stop the Chat+ from running and get stuck with cant connect to port 27017 - heres what I had to do:
yum erase mongo-10gen-mongos mongo-10gen-tools mongo-10gen-shell (this should remove all packages of mongodb)
rpm -qa | less | grep mongo (this will list any packages not removed. if anything is listed, then use:)
rpm --qa | less | grep mongo | xargz yum remove
ANd to make sure it is is actually uninstalled:
which mongod
this should return nothing. Then you have to remove all data pertaining to the mongodb.
Delete the following directories:
/var/lib/mongo (this directory is not empty so try:
rm -rf /var/lib/mongo/*.*
rmdir /var/lib/mongo
Then - you have to reinstall mongodb
yum install mongodb-org
after that - all should be working well when you restart the Chat+ server.