2016-11-14 30 views
0

我尝试使用命令mongod开始的mongod从/etc/init.d中的文件夹的过程,但我得到了下面的错误启动mongod的过程:无法在RedHat

2016-11-14T16:26:55.264+0530 I CONTROL [initandlisten] MongoDB starting : pid=16092 port=27017 dbpath=/data/db 64-bit host=xyz 
2016-11-14T16:26:55.264+0530 I CONTROL [initandlisten] db version v3.0.12 
2016-11-14T16:26:55.264+0530 I CONTROL [initandlisten] git version: 33934938e0e95d534cebbaff656cde916b9c3573 
2016-11-14T16:26:55.264+0530 I CONTROL [initandlisten] build info: Linux ip-10-93-197-138 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 BOOST_LIB_VERSION=1_49 
2016-11-14T16:26:55.264+0530 I CONTROL [initandlisten] allocator: tcmalloc 
2016-11-14T16:26:55.264+0530 I CONTROL [initandlisten] options: {} 
2016-11-14T16:26:55.289+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 
2016-11-14T16:26:55.289+0530 I CONTROL [initandlisten] dbexit: rc: 100 

上述错误说,这是无法找到dbpath,但mongod脚本文件应该从/etc/mongod.conf文件中选择配置,我已经提到了dbpath,在这里我从mongod脚本文件中提取了一些内容,通过它我们知道它是假设选择配置从/etc/mongod.conf文件:

#!/bin/bash 
# mongod - Startup script for mongod 
# chkconfig: 35 85 15 
# description: Mongo is a scalable, document-oriented database. 
# processname: mongod 
# config: /etc/mongod.conf 
# pidfile: /var/run/mongodb/mongod.pid 
. /etc/rc.d/init.d/functions 
# things from mongod.conf get there by mongod reading it 
# NOTE: if you change any OPTIONS here, you get what you pay for: 
# this script assumes all options are in the config file. 
CONFIGFILE="/etc/mongod.conf" 
OPTIONS=" -f $CONFIGFILE" 
SYSCONFIG="/etc/sysconfig/mongod" 

这里有来自mongod.conf文件中的一些contetns:

# mongod.conf 
# for documentation of all options, see: 
# http://docs.mongodb.org/manual/reference/configuration-options/ 
# where to write logging data. 
systemLog: 
    destination: file 
    logAppend: true 
    path: /var/log/mongodb/mongod.log 
# Where and how to store data. 
storage: 
    dbPath: /var/lib/mongo 
    journal: 
    enabled: false 
# engine: 
    mmapv1: 
    smallFiles: true 
# wiredTiger: 

我能够通过在命令本身指定--dbpath选项来启动mongod的过程如下:

mongod --dbpath /var/lib/mongo 

但我想知道原因,为什么它不从/etc/mongod.conf文件中选择dbpath。

在此先感谢。

回答