我尝试使用修改后的dbpath在服务器(服务器上的VM)上运行mongod。我使用默认的dbpath对它进行了测试,结果没问题。
这是我得到的命令和错误:
sudo mongod --dbpath /mnt/PROJET-CIRMAR/aisdb/
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] MongoDB starting : pid=3350 port=27017 dbpath=/mnt/PROJET-CIRMAR/aisdb/ 64-bit host=PROJET-CIRMAR2
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] db version v3.4.1
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] modules: enterprise
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] build environment:
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] distmod: ubuntu1604
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] distarch: x86_64
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] target_arch: x86_64
2017-02-01T10:31:44.272+0100 I CONTROL [initandlisten] options: { storage: { dbPath: "/mnt/PROJET-CIRMAR/aisdb/" } }
2017-02-01T10:31:50.291+0100 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to lock file: /mnt/PROJET-CIRMAR/aisdb/mongod.lock No locks available. Is a mongod instance already running?, terminating
2017-02-01T10:31:50.291+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-02-01T10:31:50.292+0100 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-02-01T10:31:50.292+0100 I CONTROL [initandlisten] now exiting
2017-02-01T10:31:50.292+0100 I CONTROL [initandlisten] shutting down with code:100
检查目录后,我看到mongod.lock文件已创建,但服务器无法正常运行。
我分别尝试了这两个命令,但结果是一样的。
sudo chown mongodb /mnt/PROJET-CIRMAR/aisdb/
和
sudo chown pilmngr /mnt/PROJET-CIRMAR/aisdb/
我还更改了dbPath
文件中的mongod.conf
。并了解有关目录的更多信息:
df -h
Filesystem Size Used Avail Use% Mounted on
udev 981M 0 981M 0% /dev
tmpfs 201M 3.2M 197M 2% /run
/dev/vda1 18G 3.9G 13G 24% /
tmpfs 1001M 0 1001M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1001M 0 1001M 0% /sys/fs/cgroup
192.168.73.1:/volume2/projets/PROJET-CIRMAR 11T 535G 9.8T 6% /mnt/PROJET-CIRMAR
tmpfs
所以,我认为该目录就像安装了外部硬盘。我尝试使用另一个目录(不在/mnt/...
上)运行MongoDB,它也有效。你有什么解决方案吗?