mongodb4.0已经发布,但是鉴于线上环境更多的是使用旧版本的mongodb,我们这里使用的mongodb3.4版本。
官网下载地址为:https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.18.tgz
直接解压 tar zxvf mongodb-linux-x86_64-rhel62-3.4.2.tgz 然后移动修改目录名字(可以做成软连接的形式) mv mongodb-linux-x86_64-rhel62-3.4.2 /usr/local/mongodb mongodb的二进制预编译方式已经安装完成。 [root@test3 mongodb]# pwd /usr/local/mongodb [root@test3 mongodb]# ls bin GNU-AGPL-3.0 MPL-2 README THIRD-PARTY-NOTICES [root@test3 mongodb]# 需要注意的是二进制预编译包没有默认的配置文件,但是默认的配置参数。 #还有就是mongodb的启动一定要放在配置文件中启动不要在命令行指定参数启动 #在当前目录创建conf目录 mkdir conf #编写配置文件mongod.cnf #配置文件如下
[root@test3 conf]# cat 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: /data/mongod/log/mongod.log # Where and how to store data. storage: dbPath: /data/db journal: enabled: true # engine: # mmapv1: # wiredTiger: # how the process runs processManagement: fork: true # fork and run in background pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile # network interfaces net: port: 27017 bindIp: # Listen to local interface only, comment to listen on all interfaces. #security: # security: # authorization: enabled #operationProfiling: #replication: #sharding: ## Enterprise-Only Options #auditLog: #snmp: