zoukankan      html  css  js  c++  java
  • MongoDB【第一篇】安装

    第一步:准备

    1. 操作系统

    CentOS-7-x86_64-Everything-1511

    2. MongoDB 版本

    mongodb-linux-x86_64-rhel70-3.4.2

    3. 设置 ulimit

    1)查看

    # uimit -a

    2)配置 open files

    # echo "* soft nofile 65535" >> /etc/security/limits.conf
    # echo "* hard nofile 65535" >> /etc/security/limits.conf

    3)配置 max processes

    # ulimit -u 65535

    注意:修改后仅在当前 shell 中生效,所以请确保在当前 shell 中启动 MongoDB 。如果退出重登录,需要重新进行设置。

    4)修改 transparent_hugepage

    # echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
    # echo "never" > /sys/kernel/mm/transparent_hugepage/defrag

    注意:修改后如果重新启动主机,则需要重新执行上述命令。

    5)修改 zone_reclaim_mode

    # echo 0 > /proc/sys/vm/zone_reclaim_mode

    第二步:安装

    1. 安装包

    mongodb-linux-x86_64-rhel70-3.4.2.tgz

    2. 解压

    # tar zxvf mongodb-linux-x86_64-rhel70-3.4.2.tgz

    3. 创建目录

    # mv mongodb-linux-x86_64-rhel70-3.4.2 mongodb
    # cd mongodb
    # mkdir logs
    # mkdir dbfile

    4. 创建配置文件

    # vi mongo.conf

    配置文件内容:

    systemLog:
        destination: file
        path: /root/mongodb/logs/mongo.log
        logAppend: true
    storage:
        journal:
            enabled: true
        dbPath: /root/mongodb/dbfile/
        directoryPerDB: true
        engine: wiredTiger
        wiredTiger:
            engineConfig:
                cacheSizeGB: 20
                directoryForIndexes: true
            indexConfig:
                prefixCompression: true
    processManagement:
        fork: true
    net:
        port: 27017
    replication:
        replSetName: rs1
        oplogSizeMB: 250000

    第三步:启动

    1. 启动命令

    # cd mongodb/bin
    # ./mongod --config ../mongo.conf

    2. 启动信息

    启动信息中显示 “child process started successfully, parent exiting”,即为启动成功。

  • 相关阅读:
    心跳
    UITableView 总结(一)
    scrollView的contentSize,contentInsert,contentOffset
    如何跟踪论文的作者?
    hadoop与spark执行定时任务,linux执行定时任务
    java.lang.NoSuchMethodError问题处理
    数据挖掘与机器学习的相关理解
    HBASE
    腾讯云ping不通外网
    腾讯云,激活ubuntu root登录,设置ssh
  • 原文地址:https://www.cnblogs.com/RUReady/p/6475335.html
Copyright © 2011-2022 走看看