本文共 1373 字,大约阅读时间需要 4 分钟。
配置文件1
# mongod.confsystemLog: destination: file logAppend: truestorage: journal: enabled: true directoryPerDB: true engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 2 directoryForIndexes: true indexConfig: prefixCompression: trueprocessManagement: fork: truenet: port: 27017
目录介绍
/data/wyd/mongodb下的目录内容如下backup(备份) log(日志) pid(pid文件) script shard-a-primary(数据库目录)cacheSize是指系统分配给mongod用的内存,比如你系统有三十G内存,你可以分配二十四G内存给Mongodb
配置文件详细说明参考
Mongodb内存缓存大小配置
启动
numactl --interleave=all mongod -f /etc/mongod.conf \--dbpath /data/wyd03/mongodbard-a-primary \--logpath /data/wyd03/mongodb/logard-a-primary.log \--pidfilepath /data/wyd03/mongodb/pidard-a-primary.pid --port 27021
指定不一样的pid和端口这样就可以起启多个不一样的进程
线上配置文件二
dbpath=/data/mongodb/dblogpath=/data/mongodb/logs/mongodb.logbind_ip=127.0.0.1port=27017fork=truenohttpinterface=trueauth=true
启动
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/conf/mongodb.conf线上配置文件三
systemLog: quiet: false logAppend: true destination: file path: /data/mongodb/logs/mongod.logstorage: dbPath: /data/mongodb/db journal: enabled: true engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 16 indexConfig: prefixCompression: trueprocessManagement: fork: truenet: bindIp: 127.0.0.1 port: 27017security: authorization: enabled
转载于:https://blog.51cto.com/yht1990/2147567