How to I get mongo to use a mounted drive on ec2? I really do not understand. I attached a volume on ec2 formatted the drive as root and start as root and yet as root I ca
This is what I did to fix the problem:
$sudo mkdir -p /data/db
$export PATH=/usr/local/Cellar/mongodb/3.0.7/bin:$PATH
$sudo chown -R id -u
/data/db
and then to start mongo...
$mongod
I use this method to solve the problem:
sudo chown -R mongodb:mongodb /data/db
On a Fedora 18 with Mongo 2.2.4 instance I was able to get around a similar error by disabling SELinux by calling setenforce 0
as root.
BTW, this was a corporate environment, not an Amazon EC2 instance, but the symptoms were similar.
You could try by these ways. 1st.
sudo chown -R mongod:mongod /data/db
but at some times,this is not useful. 2nd. if the above way is not useful,you can try to do this:
mkdir /data/db #as the database storage path
nohup mongod --dbpath /data/db &
or type:
mongod --dbpath /data/db
to get the output stream
If you literally want a one line equivalent to the commands in your original question, you could alias:
mongo --eval "db.getSiblingDB('admin').shutdownServer()"
https://stackoverflow.com/a/11777141/7160782
I had the same problem.
I solved it by changing selinux status to permissive with below command:
setenforce 0