zoukankan      html  css  js  c++  java
  • MongoDB Installaion

     
    Package installation(CentOS 6.4)

    1.下载安装包并解压

    tar -zxvf mongodb-linux-x86_64-3.0.1.tgz
     
    2.将解压包移动到 mongodb 将会运行的路径
    mkdir –p /opt/app/mongodb
    mv  /opt/install/mongodb-linux-x86_64-3.0.1/ mongod
     
    3。配置环境变量
    Ensure the location of the binaries is in the PATH variable.

    you can add the following line to your shell’s rc file (e.g. $HOME/.bash_profile):

    export PATH$HOMGO_HOME/bin:$PATH
    

    Run mongodb instance with dameo

    4.1 Create the data directory.

    在运行 mongod 之前需要建立mongod进程要写入数据的路径,该路径默认为:/data/db 。 如果想更换为自己指定的路径,则需要先创建该目录并且在 mongod 集成启动的时候添加dbpath选项明确地指出该路径。

    mkdir -p /opt/mongo_data/db

    4.2 建立启动和停止脚本

    1.mongodb默认端口是27017,如果需要修改则在启动mongod进程时候则需要使用—port 选项,例如:—port 12345

    2.mongodb以后台运行任务方式启动

    mongod --fork --logpath /var/log/mongodb.log  --dbpath /opt/mongo_data/db

    3.停止mongodb进程
     3.1从 mongo shell则使用  use admin db.shutdownServer() 
     3.2 使用mongod --shutdown 命令停止mongod进程
     例如:mongod --logpath /var/log/mongodb.log  --dbpath /opt/mongo_data/db  --shutdown 
      3.3 使用kill命令停止mongod进程
     
    参考资料
     http://docs.mongodb.org/master/tutorial/install-mongodb-on-linux/
    http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/
  • 相关阅读:
    LeetCode
    已知二叉树的先序遍历和中序遍历序列求后序遍历序列
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    TCP协议的基本规则和在Java中的使用
    Java中UDP协议的基本原理和简单用法
    LeetCode
  • 原文地址:https://www.cnblogs.com/lily-tiantian/p/4365830.html
Copyright © 2011-2022 走看看