在CentOS 7上安装MongoDB

前端之家收集整理的这篇文章主要介绍了在CentOS 7上安装MongoDB前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

参考博文:https://www.jianshu.com/p/ccdd3e884b86

一、安装准备
1、修改系统配置
#关闭selinux、firewall
#修改/etc/security/limits.conf添加以下内容

  • soft nofile 65536
  • hard nofile 65536
  • soft nproc 65536
  • hard nproc 65536
    #修改/etc/security/limits.d/20-nproc.conf
  • soft nproc 65536
    3、创建账户、目录
    groupadd -g 600 mongo
    useradd -u 600 -g mongo mongo

二、安装步骤1、解压文件tar xvf mongodb-linux-x86_64-enterprise-rhel70-3.6.2.tgz -C /usr/local/cd /usr/localmv mongodb-linux-x86_64-enterprise-rhel70-3.6.2/ mongodbcd mongodbmkdir -p data/dbmkdir logtouch log/mongod.logmkdir etctouch etc/mongod.confchown -R mongo.mongo /usr/local/mongodb2、创建配置文件/usr/local/mongodb/data/mongodb/config/mongod.confsystemLog:destination: filepath: /usr/local/mongodb/data/mongodb/log/mongod.loglogAppend: truestorage:journal:enabled: truedbPath: /usr/local/mongodb/data/db/directoryPerDB: trueengine: wiredTigerwiredTiger:engineConfig:cacheSizeGB: 4directoryForIndexes: truecollectionConfig:blockCompressor: noneindexConfig:prefixCompression: trueprocessManagement:fork: truepidFilePath: /usr/local/mongodb/data/mongodb/mongod.pidnet:port: 27017bindIp: 192.168.1.2133、取消透明大页在/etc/rc.d/rc.local增加下列内容:if test -f /sys/kernel/mm/transparent_hugepage/enabled; thenecho never > /sys/kernel/mm/transparent_hugepage/enabledfiif test -f /sys/kernel/mm/transparent_hugepage/defrag; thenecho never > /sys/kernel/mm/transparent_hugepage/defragfichmod +x /etc/rc.d/rc.local4、修改环境变量.bash_profileJAVA_HOME=/usr/local/jdkCLASSPATH=$JAVA_HOME/libPATH=$JAVA_HOME/bin:$PATH:$HOME/bin:/usr/local/mongodb/binexport PATH JAVA_HOME CLASSPATH#重新加载.bash_profile. .bash_profile5、启动MongoDByum install -y net-snmp* gcc-c++ nohup mongod -f /usr/local/mongodb/data/mongodb/config/mongod.conf >/dev/null 2>&1 &6、登录测试mongo 192.168.1.213:270177、Mongodb C drive安装tar xvf mongo-c-driver-1.6.1.tar.gzcd mongo-c-driver-1.6.1/./configure -disable-automatic-init-and-cleanupmakemake install

原文链接:https://www.f2er.com/centos/374861.html

猜你在找的CentOS相关文章