介绍安装的文档很多,可以参考这篇:

http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/

安装完后你可能会碰到的2个问题。

1.让mongod在后台运行
启动mongo的命令mongod有一个参数--fork可以使mongo在后台运行,但同时必须设置--logpath参数指定启动日志文件的路径,因为此时日志无法写到控制台了。例子:

mongod --fork --logpath /var/log/mongod.log
The MongoDB daemon (mongod) has a command-line option to run the server in the background...

--fork

This command-line option requires that you also specify a file to log messages to (since it can not use the current console). An example of this command looks like:

mongod --fork --logpath /var/log/mongod.log

You could put this into an /etc/init.d/mongod bash script file. And then to have the service run at startup, create the standard symbolic links (S## & K##) inside of /etc/rc#.d/. Here is a tutorial that explains this process in more detail. Scroll down to the section titled "Init Script Activation". This also has the added benefit of being able to execute commands like...

service mongod status
service mongod start
service mongos stop

2.执行mongod —fork —logpath /var/log/mongod.log 出错

about to fork child process, waiting until server is ready for connections. forked process: 10293 child process started successfully, parent exiting

这是因为当前用户对日志目录/var/log的权限不足

MongoDB Linux 安装配置 后台运行的更多相关文章

  1. Linux安装配置go运行环境

    1. 下载go,解压 gz包 wget https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz tar zxvf go1.7. ...

  2. linux经常使用(一)linux 安装配置 jdk之 找不到安装文件文件夹及source /etc/profile 报unexpected end of file 错误 解决

    linux 安装配置 jdk 应该算是一个非常主要的东西.可是我到如今才自己第一次 正式安装.果然出现了问题.. 问题就是 安装之后 找不到 安装路径 ,进而没法配置环境变量. 现象例如以下: 提示 ...

  3. Linux安装配置apache

    Linux安装配置apache   1.获取软件: http://httpd.apache.org/  httpd-2.2.21.tar.gz 2.安装步骤: 解压源文件: 1 tar zvxf ht ...

  4. Linux安装配置php环境的方法

    本文实例讲述了Linux安装配置php环境的方法.分享给大家供大家参考,具体如下: 1.获取安装文件: http://www.php.net/downloads.php php-5.3.8.tar.g ...

  5. MongoDB的安装配置、基本操作及Perl操作MongoDB

    MongoDB的安装配置.基本操作及Perl操作MongoDB http://www.myhack58.com/Article/60/63/2014/42353.htm

  6. Linux安装配置varnish web加速器

    Linux安装配置varnish web加速器       Varnish是一款高性能的开源HTTP加速器,它可以来做纯粹的代理服务器,负载均衡,但varnish最主要的功能是缓存加速,也是它最出色的 ...

  7. Linux环境下NodeJS和MongoDB的安装配置

     一.NodeJS的安装配置 #进入安装目录cd /usr/local/ #删除原有安装rm -rf noderm -rf node-v0.10.29-linux-x64 #解压压缩包tar -zxv ...

  8. MongoDB Linux安装

    MongoDB 提供了 linux 各发行版本 64 位的安装包,你可以在官网下载安装包. 下载地址:https://www.mongodb.com/download-center#community ...

  9. Linux安装配置VPN服务器

    一.实验简介 VPN ,中文翻译为虚拟专有网络,英文全称是 Virtual Private Network .现在 VPN 被普遍定义为通过 一个公用互联网络建立一个临时的.安全的连接,是一条穿过混乱 ...

随机推荐

  1. 【转】ruby 时间日期处理

    我们可以使用Time类来生成一个当前时间的对象: t = Time.new 或 t = Time.now Time类有类方法mktime(同义方法是local方法)来根据传入的参数生成时间对象,并且它 ...

  2. ss2

    一. *** 服务端配置 1. 在命令行窗口输入下面4行命令并回车执行 yum -y update yum install -y python-setuptools && easy_i ...

  3. C# 处理Json

    下面是JSON对象转换为字符串 public static string ToJson(object obj) { try { JavaScriptSerializer serializer = ne ...

  4. Linux查看并修改mysql的编码

    系统:阿里云 一.查看mysql字符集 输入:show variables like 'character_set_%'; 二.修改某一个数据库的编码 输入:alter database dbname ...

  5. [poj1390]Blocks(方块消除)

    题目大意:给定一序列,可点击某一位置消除与其相邻且相同的方块,得分为$len*len$,求最大得分. 解题关键:关键是状态的构造,首先离散化一下,令$dp[i][j][k]$表示序列$i-j$且后面有 ...

  6. 六种获取配置properties文件的方法

    总结一下六种获取配置properties文件的方法,代码如下: package com.xujingyang.test ; import java.io.BufferedInputStream ; i ...

  7. error C2039: “addTextureMesh”: 不是“pcl::visualization::PCLVisualizer”的成员

    error C2039: "addTextureMesh": 不是"pcl::visualization::PCLVisualizer"的成员 PCL 1.6 ...

  8. maven 打JAR包资源文件指定路径与文件读取

    1.配置RESOURCES节点 有时会遇到maven打包后找不到资源文件了,其实这时候路径发生了变化,为了确保打包后路径不发生变化,指定一个固定的路径,请看下面配置 <build> ... ...

  9. Java基础——深入剖析Java中的装箱和拆箱

    (转自:http://www.cnblogs.com/dolphin0520/p/3780005.html) 自动装箱和拆箱问题是Java中一个老生常谈的问题了,今天我们就来一些看一下装箱和拆箱中的若 ...

  10. c# 指针unsafe/fixed -- 【一】

    指针C#unsafefixed 目录(?)[-] 概述 unsafe fixed 1.1 概述 unsafe关键字表示不安全上下文,该上下文是任何涉及指针的操作所必需的.可以在属性.方法.类的声明中使 ...