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 cant access? I am running on ubuntu 12.04. No other mongo is running
I see that mongo made a 'db' dir in /data i.e. /data/db
cd /
ls -al
drwxr-xr-x 4 root root 4096 Mar 5 16:28 data
cd /data
ls -al
total 28
drwxr-xr-x 4 root root 4096 Mar 5 16:28 .
drwxr-xr-x 24 root root 4096 Mar 5 16:28 ..
drwxr-xr-x 2 root root 4096 Mar 5 16:28 db
drwx------ 2 root root 16384 Mar 5 16:20 lost+found
sudo mkfs.ext3 /dev/xvdh
sudo mkdir /data
sudo su - -c 'echo "/dev/xvdh %s auto noatime 0 0" | sudo tee -a /etc/fstab'
sudo mount /data
sudo service mongodb start
mongodb start/running, process 17169
sudo ps -ef | grep mongod
ubuntu 15763 15634 0 16:32 pts/2 00:00:00 tail -f mongodb.log
ubuntu 18049 15766 0 16:43 pts/3 00:00:00 grep --color=auto mongod
Tue Mar 5 16:33:15 [initandlisten] MongoDB starting : pid=15890 port=27017 dbpath=/data 64-bit host=aws-mongo-server-east-staging-20130305161917
Tue Mar 5 16:33:15 [initandlisten] db version v2.2.3, pdfile version 4.5
Tue Mar 5 16:33:15 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Tue Mar 5 16:33:15 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Tue Mar 5 16:33:15 [initandlisten] options: { bind_ip: "10.157.60.27", config: "/etc/mongodb.conf", dbpath: "/data", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", replSet: "heythat" }
Tue Mar 5 16:33:15 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Tue Mar 5 16:33:15 dbexit:
Tue Mar 5 16:33:15 [initandlisten] shutdown: going to close listening sockets...
Tue Mar 5 16:33:15 [initandlisten] shutdown: going to flush diaglog...
Tue Mar 5 16:33:15 [initandlisten] shutdown: going to close sockets...
Tue Mar 5 16:33:15 [initandlisten] shutdown: waiting for fs preallocator...
Tue Mar 5 16:33:15 [initandlisten] shutdown: lock for final commit...
Tue Mar 5 16:33:15 [initandlisten] shutdown: final commit...
Tue Mar 5 16:33:15 [initandlisten] shutdown: closing all files...
Tue Mar 5 16:33:15 [initandlisten] closeAllFiles() finished
Tue Mar 5 16:33:15 [initandlisten] shutdown: removing fs lock...
Tue Mar 5 16:33:15 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Tue Mar 5 16:33:15 dbexit: really exiting now
Below is if I restart when I remove a lock file....
Tue Mar 5 16:59:15 [initandlisten] MongoDB starting : pid=21091 port=27017 dbpath=/data 64-bit host=aws-mongo-server-east-staging-20130305161917
Tue Mar 5 16:59:15 [initandlisten] db version v2.2.3, pdfile version 4.5
Tue Mar 5 16:59:15 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Tue Mar 5 16:59:15 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Tue Mar 5 16:59:15 [initandlisten] options: { bind_ip: "10.157.60.27", config: "/etc/mongodb.conf", dbpath: "/data", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", replSet: "heythat" }
Tue Mar 5 16:59:15 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Tue Mar 5 16:59:15 dbexit:
Tue Mar 5 16:59:15 [initandlisten] shutdown: going to close listening sockets...
Tue Mar 5 16:59:15 [initandlisten] shutdown: going to flush diaglog...
Tue Mar 5 16:59:15 [initandlisten] shutdown: going to close sockets...
Tue Mar 5 16:59:15 [initandlisten] shutdown: waiting for fs preallocator...
Tue Mar 5 16:59:15 [initandlisten] shutdown: lock for final commit...
Tue Mar 5 16:59:15 [initandlisten] shutdown: final commit...
Tue Mar 5 16:59:15 [initandlisten] shutdown: closing all files...
Tue Mar 5 16:59:15 [initandlisten] closeAllFiles() finished
Tue Mar 5 16:59:15 [initandlisten] shutdown: removing fs lock...
Tue Mar 5 16:59:15 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Tue Mar 5 16:59:15 dbexit: really exiting now
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…