zoukankan      html  css  js  c++  java
  • mongodb-安装&配置&启动

    下载:https://www.mongodb.com/dr/fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.3.tgz/download

    解压:tar -zxvf mongodb-linux-x86_64-rhel70-4.0.3.tgz 

    启动服务端:

    [root@cent7-zuoys bin]# cd mongodb-linux-x86_64-rhel70-4.0.3/bin

    直接运行./mongod,报错:NonExistentPath: Data directory /data/db not found., terminating

    --创建数据库存储目录和日志存储目录

    [root@cent7-zuoys bin]# mkdir data

    [root@cent7-zuoys bin]# cd data

    [root@cent7-zuoys data]# mkdir db

    [root@cent7-zuoys data]# mkdir logs

    --创建mongodb.conf并配置

    进入/root/mongodb/mongodb-linux-x86_64-rhel70-4.0.3/bin目录

    [root@cent7-zuoys bin]# vi mongodb.conf 

    内容如下:

    #MongoDB config start - 2018-10-22

    # 设置数据文件的存放目录
    dbpath=/root/mongodb/mongodb-linux-x86_64-rhel70-4.0.3/bin/data/db

    # 设置日志文件的存放目录及其日志文件名
    logpath = /root/mongodb/mongodb-linux-x86_64-rhel70-4.0.3/bin/data/logs/mongodb.log

    #任何远程ip都能访问
    bind_ip = 0.0.0.0
    # 设置端口号(默认的端口号是 27017)
    port = 27017

    #如果auth=true则,客户端所有操作都需要一个用户;否则,不需要用户,可以匿名操作。

    #auth=true

    # 设置为以守护进程的方式运行,即在后台运行
    #fork = true

    # nohttpinterface = true

    #MongoDB config end - 2018-10-22

    启动服务端:

    [root@cent7-zuoys bin]# ./mongod --config mongodb.conf 

    启动成功后,远程telnet,成功。

    启动客户端:

    [root@cent7-zuoys ~]# cd mongodb/mongodb-linux-x86_64-rhel70-4.0.3/bin/
    [root@cent7-zuoys bin]# ./mongo

    MongoDB shell version v4.0.3
    connecting to: mongodb://127.0.0.1:27017

    参考:https://www.linuxidc.com/Linux/2016-06/132675.htm

  • 相关阅读:
    CentOS 出错处理
    g13 root
    修复误删系统文件
    c++ list sort方法
    批量修改outlook联系人头像,并同步手机
    IT大牛们 学术搜索
    oracle 表空间操作
    CentOS 5.5 安装MPICH2\MRNet\Launchmon时遇到的问题
    自我反省
    积累航程
  • 原文地址:https://www.cnblogs.com/yaoyuan2/p/9828880.html
Copyright © 2011-2022 走看看