我在我的电脑上使用arch linux(64位机器)安装了mongo。 在开始之前,我已经将mongo数据库文件移动到具有大量(11 Gb)空间的新位置。但如果我运行mongod,它会失败,因为设备上没有空间。如果我以root身份运行它,则可以运行。我的潜在问题在哪里?我是mongo的新手。
mongo version
$ mongod --version
db version v3.0.7
git version: nogitversion
mongo conf
$ cat /etc/mongodb.conf
# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details
# Run mongod --help to see a list of options
bind_ip = 127.0.0.1
quiet = true
#dbpath = /var/lib/mongodb
dbpath = /home/data/mongodb
logpath = /var/log/mongodb/mongod.log
logappend = true
$
检查可用空间
$ sudo -u mongodb df -h /home/data/mongodb/
Souborový systém Velikost Užito Volno Uži% Připojeno do
/dev/sda3 208G 187G 11G 95% /home
$
检查权限
$ sudo -u mongodb ls -lisa /home/data/mongodb
celkem 12
3547175 4 drwx------ 2 mongodb daemon 4096 28. lis 21.38 .
3538945 4 drwxr-xr-x 5 postgres root 4096 28. lis 21.14 ..
3544083 4 -rw-r--r-- 1 mongodb root 69 28. lis 21.17 storage.bson
$ sudo -u mongodb ls /home/data/mongodb/
storage.bson
问题
$ sudo -u mongodb mongod --repair
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] exception in initAndListen: 39 Unable to write process id 4565 to file: /data/db/mongod.lock errno:28 No space left on device, terminating
2015-11-29T16:24:08.722+0100 I CONTROL [initandlisten] now exiting
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] shutdown: closing all files...
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] closeAllFiles() finished
2015-11-29T16:24:08.722+0100 I CONTROL [initandlisten] dbexit: rc: 100
$
以root身份
$sudo mongod --repair
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] MongoDB starting : pid=4610 port=27017 dbpath=/data/db 64-bit host=optiplex
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] db version v3.0.7
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] git version: nogitversion
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] build info: Linux flo 4.2.3-1-ARCH #1 SMP PREEMPT Sat Oct 3 18:52:50 CEST 2015 x86_64 BOOST_LIB_VERSION=1_59
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] allocator: tcmalloc
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] options: { repair: true }
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] finished checking dbs
2015-11-29T16:25:56.793+0100 I CONTROL [initandlisten] now exiting
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] shutdown: closing all files...
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] closeAllFiles() finished
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] shutdown: removing fs lock...
2015-11-29T16:25:56.793+0100 I CONTROL [initandlisten] dbexit: rc: 0
在日志中我没有新记录......
感谢您的帮助。