---
title: "mongo 启动方式"
author: "朱秋旭"
date: "2016-05-30T17:43:43Z"
tags: []
categories: ["互联网"]
slug: "mongo"
draft: false
lastmod: "2016-05-30T17:43:43Z"
id: 2301950
url: "https://himichaelchu.iteye.com/blog/2301950"
---

mongodb 使用命令行启动

 

#bin/mongod

 

--dbpath arg                          directory for datafiles - defaults to /data/db

--logpath arg                         log file to send write to instead of  stdout - has to be a file, not  directory

 

--fork                                fork server process

 

--port arg                            specify port number - 27017 by default

 

也可以使用配置文件

 

-f \[ --config ] arg                   configuration file specifying  additional options

 

\# vi /data/mongo/mongodb.cnf

dbpath=/data/mongo/

logpath=/data/mongo/mongo.log

logappend=true

fork=true

port=27017