Moped::Errors::ConnectionFailure Could not connect to any secondary or primary nodes for replica set - mongoid

I had to forcefully shutdown my Ubuntu system after it got hanged. Now I get this error while trying to run my Rails app.
Moped::Errors::ConnectionFailure (Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]>):
Im using Rails 3.2.11 with Mongoid 3.1.4.
What could be wrong?

I was able to get it working by removing the mongod.lock file and restarting mongodb service
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb start

Uninstall mongodb using
sudo apt-get autoremove mongodb-*
then install with
apt-get install mongodb-server
run mongo
it will solve the problem

Related

how to get database back while xampp is not working

I have created a database in MySQL using XAMPP But In Some How My XAMPP Server is Not Working Now I am trying to Get My data Back
It's in
xampp\mysql\data
folder. Or you can export the database in PHPmyadmin.
If you use Linux, you can install mysql-client and mysql-server:
sudo apt-get install mysql-client
sudo apt-get install mysql-server
and then access to phpMyAdmin with navigate to where you extract mysql. Then run this command:
php -S localhost:80
If you use windows, you can use an alternative software instead. I think Laragon is a good alternative software.

MongoDB not starting after downgrade

MongoDB automatically updated to 3.6 after doing a system update and was no longer compatible with my old dataset. So I downgraded to 3.4 again, however now the mongo instance won't start at all and exits with error code 100. Any help would be appreciated.
There were a series of issues piggybacking on one another here, but I sorted this out.
Firstly I reverted from 3.6 to 3.4 by uninstalling Mongo:
sudo service mongod stop
sudo apt-get purge mongodb-org*
Then I installed the specific version of Mongo:
apt-get install mongodb-org=3.4.1 mongodb-org-server=3.4.1 mongodb-org-shell=3.4.1 mongodb-org-mongos=3.4.1 mongodb-org-tools=3.4.10
Then I deleted the .lock files:
rm -rf /path/to/mongod.lock
rm -rf /path/to/WiredTiger.lock
Next you have to grant permissions to Mongo again:
sudo systemctl enable mongod
(Make sure the dbpath is correct in /etc/mongod.conf. If you want to make any changes to the mongod.service file, do it now, and remember to run systemctl daemon-reload to set the changes.)
Then finish updating permissions:
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb
Now service mongod start or sudo systemctl mongod start should work.
Here are links to some of the resources I found helpful:
Installing Mongo on Ubunut
Uninstalling MongoDB
Installing a specific version of Mongo
Setting Mongo file permissions

Update Apache 2.4.34 to 2.4.35 in Ubuntu 16.04

I have tried the following first in Ubuntu Server
sudo apt-get update
sudo apt-get upgrade
No signs of software updates in the Ubuntu Server repository.
So I went ahead with PPA with the following
add-apt-repository ppa:ondrej/apache2
apt-get update
apt-get upgrade
OR
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt install apache2
But no luck as PPA is having 2.4.34 as the latest one.
NOTE: Even I restarted and check with stopping and starting my Apache2
server.
But seems nothing working is there any other way I can update it to the latest version. This is important as our project is stuck with a Security Assessment.
And in version 2.4.34 there is DDOS security vulnerability. And has been fixed in 2.4.35
Can anyone help me out with updating apache2, even redirects to any sites or links are welcome.
All you need to download this version and enjoy , just
install it manually https://httpd.apache.org/download.cgi

Uninstall MongoDB on Mac OS X

When I try to run mongod from the terminal, I get the following error:
2014-07-02T23:56:24.797-0700 [initandlisten] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2014-07-02T23:56:24.797-0700 [initandlisten] ERROR: addr already in use
I recently realize that I have two versions of MongoDB on my Mac, and think this may be the source for the above error. (Plus, I do not need two version.) I tried Googling, but was not able to find clear directions on how I can uninstall. I have development version 2.7.0 AND 2.6.3.
Thanks so much in advance for the help!
Run the following commands to remove mongodb from the launch/startup and to uninstall it using Homebrew:
# See if mongo is in the launch/startup list
launchctl list | grep mongo
# Remove mongodb from the launch/startup
launchctl remove homebrew.mxcl.mongodb
# Kill the mongod process just in case it's running
pkill -f mongod
# Now you can safely remove mongodb using Homebrew
brew uninstall mongodb
Just double-check in /usr/local/bin/ to make sure that the mongodb commands are removed.
For uninstalling the community version, i found that the command brew uninstall mongodb-community worked for me
Nitin Jadhav version worked for me, brew uninstall mongodb kept given me Error: No such keg: /usr/local/Cellar/mongodb. I was removing a mongodb-community.
use cd /usr/local/Cellar then run ls -a and then run rm -rf mongodb-community to remove it
I would suggest navigating into your /usr/local/Cellar and run an ls -a, I had a community version of mongo installed that wasn't being picked up by the command given above. If you find any mongo versions there just rm -rf each instance
For those having this error in osx:
brew uninstall mongodb Error: No such keg: /usr/local/Cellar/mongodb
execute brew list | grep mongo
for example, it could show something like:
mongodb-community#4.2
mongodb-database-tools
mongosh
remove them with brew uninstall mongodb-community#4.2 mongodb-database-tools mongosh
Also execute launchctl remove homebrew.mxcl.mongodb as #anuvrat-tiku says in his answer.

Cassandra service doesn't start

for some reason i tried to reinstall the cassandra ,
firstlly i tried this to remove cassandra:
sudo apt-get remove cassandra
and after that i removed the cassandra folders on :
/var/lib/cassandra
/var/log/cassandra
/etc/cassandra
using rm -rf command
after reinstalling cassandra 1.2.8 ,the cassandra service doesn't start
and
sudo service cassandra start
doesn't work ,
what can i do to resolve this problem?
thanks in advance,
java version = 1.6.0_27
os = ubuntu 12.04
i tried to purge a cassandra instead remove and installing again so it works now

Resources