mongodb安装
mongo安装
环境:
centos6.5
下载:
[root@localhost]# wget http://192.168.2.179/mongodb/mongodb-linux-x86_64-4.1.6.tgz
安装:
[root@localhost]# tar xf mongodb-linux-x86_64-4.1.6.tgz
[root@localhost]# cd mongodb-linux-x86_64-4.1.6
[root@localhost]# cp -r * /web/soft/mongodb4.1.6
#为了便于命令启动,需要编辑全局变量PATH
[root@localhost]# vim /etc/profile.d/mongo.sh
[root@localhost]# export PATH=$PATH:/web/soft/mongodb4.1.6/bin
[root@localhost]# source /etc/profile.d/mongo.sh
创建配置文件
systemLog:
destination: file
logAppend: true
path: /web/soft/mongodb4.1.6/mongodb.log
storage:
dbPath: /web/soft/mongodb4.1.6/data
journal:
enabled: true
directoryPerDB: true
wiredTiger:
engineConfig:
configString : cache_size=4G
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
pidFilePath: /web/soft/mongodb4.1.6/mongodb.pid
net:
port: 27010
bindIp: 0.0.0.0
maxIncomingConnections: 20000
security:
javascriptEnabled: true
replication:
oplogSizeMB: 10240
replSetName: jxdx
启动服务:
[root@localhost]# /web/soft/mongodb4.1.6/bin/mongod -f /web/soft/mongodb4.1.6/mongo.conf
查看是否启动:
[root@localhost]# netstat -tnlp | grep mongod
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 17909/mongod
以上可看出端口27017已经运行
测试
启动mongodb的shell:
[root@test ~]# mongo
MongoDB shell version: 4.1.6
connecting to: test
> show dbs
local 0.000GB
至此,MongoDB4.1.6安装完毕。