Install MONGDB "4.0.0 Version" on CentOS7

Source: Internet
Author: User
Tags install openssl mkdir mongodb

  • MONGDB Introduction
  • ??
    MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for Web applications.
    ??
    MongoDB is a product between a relational database and a non-relational database, and is the most versatile and most like relational database in a non-relational database. The data structure it supports is very loose and is a JSON-like Bson format, so you can store more complex data types. The most important feature of MONGO is that its supported query language is very powerful, its syntax is somewhat similar to object-oriented query language, almost can implement similar relational database single table query of most functions, but also support the indexing of data.
    It is characterized by high performance, easy to deploy, easy to use, and easy to store data. The main features are:

    • For collection storage, easy to store data for object types.
    • Free mode, support query, support dynamic query.
    • Supports full indexes, including internal objects.
    • Supports replication and recovery.
    • Use efficient binary data storage, including large objects such as video.
    • Automatically handles fragmentation to support scalability at the cloud level.
    • Supports multiple languages such as ruby,python,java,c++,php,c#.
    • The file storage format is Bson (an extension of JSON).
    • can be accessed over the network.

    ?

    • Installation configuration
    • Download the installation package, unzip the installation
    • Installation package Address: Https://www.mongodb.com/downloads

      # yum install openssl-devel -y   # tar zxvf mongodb-linux-x86_64-rhel70-4.0.0.tgz -C /opt# mv /opt/mongodb-linux-x86_64-rhel70-4.0.0/ /usr/local/mongodb/
    • Create a MongoDB data store directory, log directory, log file

      # mkdir -p /data/mongodb1# mkdir -p /data/logs/mongodb# touch /data/logs/mongodb/mongodb1.log# chmod -R 777 /data/logs/mongodb/mongodb1.log
    • When MongoDB is in a state of frequent access, if the shell startup process occupies too low a resource setting, an error will result in the inability to connect, and the value of ulimit-n and ulimit-u needs to be set to greater than 20000.

      # ulimit -n 25000# ulimit -u 25000
    • Creating MongoDB configuration files and startup parameters

      # cd /usr/local/mongodb/bin/# vim mongodb1.confport=27017           //默认服务器端口号dbpath=/data/mongodb1    //数据存储目录logpath=/data/logs/mongodb/mongodb1.log     //日志文件logappend=true             //使用追加方式写日志fork=true                        //后台运行maxConns=5000          //最大同时连接数storageEngine=mmapv1    //指定存储引擎为内存映射文件

    • Set kernel parameters,
    • When a node is low on available memory, the system allocates memory from other nodes

      # echo 0 > /proc/sys/vm/zone_reclaim_mode# sysctl -w vm.zone_reclaim_mode=0       
    • Start and Stop MongoDB
    • Start

      # /usr/local/mongodb/bin/mongod -f /usr/local/mongodb/bin/mongodb1.conf # netstat -antp | grep mongod    //查看进程
    • Stop it

      # /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb1.conf --shutdow
    • Configure boot-up
    • Add environment variables (directly using Mongod)

      # vim /etc/rc.localrm -rf /data/mongodb1/mongodb.lock/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/bin/mongodb1.conf# echo ‘export PATH=/usr/local/mongodb/bin:$PATH‘  >>  /etc/profile# source /etc/profile


      ?
      ?

    • Enter the database

      # mongo

    ?
    ?

    Install MONGDB "4.0.0 Version" on CentOS7

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.