2016-11-14 31 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。

在此先感謝。

回答