標籤:
根據官網的提示內容,預設的設定檔內容為
systemLog: verbosity: 0 quiet: false# traceAllExceptions: <boolean> syslogFacility: user path: "/data/mongodb/log" logAppend: false logRotate: rename destination: file timeStampFormat: iso8601-local component: accessControl: verbosity: 0 command: verbosity: 0 # COMMENT some component verbosity settings omitted for brevity storage: verbosity: 0 journal: verbosity: 0 write: verbosity: 0processManagement: fork: false pidFilePath: "/var/run/mongodb/mongod.pid"net: port: 27017 bindIp: "127.0.0.1" maxIncomingConnections: 65536 wireObjectCheck: true ipv6: false unixDomainSocket: enabled: true pathPrefix: "/tmp" filePermissions: 0700 http: enabled: true JSONPEnabled: false RESTInterfaceEnabled: false# ssl:# sslOnNormalPorts: <boolean> # deprecated since 2.6# mode: disabled# PEMKeyFile: <string># PEMKeyPassword: <string># clusterFile: <string># clusterPassword: <string># CAFile: <string># CRLFile: <string># allowConnectionsWithoutCertificates: <boolean># allowInvalidCertificates: <boolean># allowInvalidHostnames: <boolean># FIPSMode: <boolean>#security:# keyFile: "/var/lib/mongo/mongodb-keyfile"# clusterAuthMode: keyFile# authorization: disabled# javascriptEnabled: true# sasl:# hostName: <string># serviceName: <string># saslauthdSocketPath: <string>#setParameter:# <parameter1>: <value1># <parameter2>: <value2>storage: dbPath: "/data/db" indexBuildRetry: true repairPath: "/data/db/tmp" journal: enabled: true directoryPerDB: false syncPeriodSecs: 60 engine: mmapv1 mmapv1: preallocDataFiles: true nsSize: 16 quota: enforced: false maxFilesPerDB: 8 smallFiles: false journal: debugFlags: 1 commitIntervalMs: 100# wiredTiger:# engineConfig:# cacheSizeGB: 1# statisticsLogDelaySecs: 0# journalCompressor: snappy# directoryForIndexes: false# collectionConfig:# blockCompressor: snappy# indexConfig:# prefixCompression: trueoperationProfiling: slowOpThresholdMs: 100 mode: off#replication:# oplogSizeMB: 50# replSetName: repl_test# secondaryIndexPrefetch: all#sharding:# clusterRole: <string># archiveMovedChunks: <boolean>#auditLog:# destination: file# format: JSON# path: "/data/mongodb/log"# filter: <string>#snmp:# subagent: <boolean># master: <boolean>#mongos only#replication:# localPingThresholdMs: <boolean>#sharding:# autoSplit: <boolean># configDB: <string># chunkSize: <int>
注意:boolean值為true或者false,首字母不能大寫
systemLog.path為一個檔案名稱,不能為一個檔案夾,如果該檔案已存在,會建立一個新的帶日期的檔案
有了這個基礎,啟動時就可以看開機記錄檔案來查看到底是哪裡的配置有問題不能啟動
processManagement.pidFilePath為一個檔案地址,不存在也沒問題
net.ssl最好全部注釋掉,暫時不用ssl
security下最好也注釋掉,否則需要配置全部安全內容,以及keyFile一定要存在。
storage.repairPath一定要是storage.dbPath的子目錄,且目錄需要存在。
replication是複製,副本啟動,注釋掉
記得注釋掉一個引擎
這樣就可以啟動了
MongoDB YAML格式的設定檔