时间:2021-07-01 10:21:17 帮助过:12人阅读
curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz # 下载 tar -zxvf mongodb-linux-x86_64-3.0.6.tgz # 解压 mv mongodb-linux-x86_64-3.0.6/ /usr/local/mongodb
MongoDB 的可执行文件位于 bin 目录下,所以可以将其添加到 PATH 路径中:
<mongodb-install-directory> 为你 MongoDB 的安装路径。如本文的 /usr/local/mongodb
命令行中运行 MongoDB 服务
你可以再命令行中执行mongo安装目录中的bin目录执行mongod命令来启动mongdb服务。
$ ./mongod 2015-09-25T16:39:50.549+0800 I JOURNAL [initandlisten] journal dir=/data/db/journal 2015-09-25T16:39:50.550+0800 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed 2015-09-25T16:39:50.869+0800 I JOURNAL [initandlisten] preallocateIsFaster=true 3.16 2015-09-25T16:39:51.206+0800 I JOURNAL [initandlisten] preallocateIsFaster=true 3.52 2015-09-25T16:39:52.775+0800 I JOURNAL [initandlisten] preallocateIsFaster=true 7.7
1. 配置文件/etc/mongod.conf
systemLog: destination: file path: "/var/log/mongodb/mongod.log" logAppend: true storage: // journal: // enabled: true dbPath: "/data1/mongodb" directoryPerDB: true engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 6 directoryForIndexes: true collectionConfig: blockCompressor: zlib indexConfig: prefixCompression: true net: port: 27017 processManagement: fork: true // replication: // oplogSizeMB: 10000 // replSetName: Zmongocluster
2. 启动
/app/software/mongo/bin/mongod -f /app/software/mongo/bin/mongo.cnf --fork --logpath=/usr/local/mongodb/logs/mongodb2.log
如果需要什么参数可以./mongod --help参考下
lsof -i:5001 | awk ‘{print $2}‘ | sed ‘1d‘ | xargs kill -9
linux mongodb数据库的安装
标签:sof manage 下载 roc locate directory xargs 服务 replica