• ahjesus 安装mongodb企业版for ubuntu


    导入共匙

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

    创建源列表

    echo 'deb https://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/stable multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list

    刷新包

    sudo apt-get update

    安装企业版

    sudo apt-get install mongodb-enterprise

    防止意外升级到最新版,可以运行如下命令

    echo "mongodb-enterprise hold" | sudo dpkg --set-selections
    echo "mongodb-enterprise-server hold" | sudo dpkg --set-selections
    echo "mongodb-enterprise-shell hold" | sudo dpkg --set-selections
    echo "mongodb-enterprise-mongos hold" | sudo dpkg --set-selections
    echo "mongodb-enterprise-tools hold" | sudo dpkg --set-selections

    启动运行

    sudo /etc/init.d/mongod start

    验证启动成功

    验证是否启动成功可以到日志文件查看,具体位置在 /var/log/mongodb/mongod.log.

    停止

    sudo /etc/init.d/mongod stop

    重启

    sudo /etc/init.d/mongod restart
    
    
    附:update失败 提示有一个旧项的解决办法
    更新源至国内
    我用的是阿里云的源
    具体的操作是 vi /etc/apt/sources.list 在文件最前面添加以下条目(!!!操作前请做好相应备份!!!)
      deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse

     配置文件

    #fork=true #以守护进程的方式运行MongoDB,创建服务器进程,linux有效
    dbpath=D:Rubymongodb #指定数据库路径
    logpath=D:Rubymongologsdb.log #指定MongoDB日志文件,注意是指定文件不是目录
    logappend=true #使用追加的方式写日志
    journal=true #启用日志选项,MongoDB的数据操作将会写入到journal文件夹的文件里
    pidfilepath=D:Rubymongopidsdb.pid #PID File 的完整路径,如果没有设置,则没有PID文件
    bind_ip=127.0.0.1 # 绑定服务IP,若绑定127.0.0.1,则只能本机访问,不指定默认本地所有IP
    port=1986 #指定服务端口号,默认端口27017
    directoryperdb=true #设置每个数据库将被保存在一个单独的目录
    oplogSize=100 #设置oplog的大小(MB)
    auth=true #启用验证

    具体如何配置 移步官网企业版介绍中查询

    The package configures MongoDB using the /etc/mongod.conf file in conjunction with the control scripts.

  • 相关阅读:
    springmvc文件上传
    4-5 动画Animation开发指南-动画基础类
    4-4 图片控件开发详解-2
    4-3 图片控件开发详解-1
    4-2 学习构建Flutter实例项目
    3-28 本章小结
    3-27 【视频讲解】调用硬件、第三方服务以及平台交互、通知
    3-26 【文档讲解】调用硬件、第三方服务以及平台交互、通知
    3-25 【视频讲解】表单输入与富文本
    3-24 【文档讲解】表单输入与富文本
  • 原文地址:https://www.cnblogs.com/ahjesus/p/3700441.html
Copyright © 2020-2023  润新知