zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    怎样判断某个分辨率是不是 16:9
    最简单的判断是否为IE浏览器的方法
    S4 smartforms切换到非word编辑器
    字符串中数字和汉字之前打空格
    elasticsearch 中term查询
    小程序 反编译 pc微信
    vue-element-admin vue-amap使用高德地图 文档没有示例代码
    高德地图 自适应 显示多个点标记
    laravel5 清理 bootstrap/cache/config.php
    element-admin 上传 跨域 问题 http-request
  • 原文地址:https://www.cnblogs.com/ahjesus/p/3700441.html
Copyright © 2011-2022 走看看