mac上安装mongodb数据库教程

系统 1699 0

1.官网下载压缩包,并解压到当地任一目录。(我的是Documents/develop/mongodb)

2.在mongodb下新建data文件夹,在data下新建db文件夹。(bin和data文件夹在一级)

3.进入bin文件夹,并设置数据库数据存放的地址变量

      cd Documents/develop/mongodb/bin


    

      ./mongod --dbpath /Users/wangming/Documents/develop/mongodb/data/db


    

  出现以下提示

      2014-09-24T09:26:11.776+0800 [initandlisten] MongoDB starting : pid=1229 port=27017 dbpath=/Users/wangming/Documents/develop/mongodb/data/db 64-bit host=wangmingdeMacBook-Pro.local

2014-09-24T09:26:11.776+0800 [initandlisten] 

2014-09-24T09:26:11.776+0800 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000

2014-09-24T09:26:11.776+0800 [initandlisten] db version v2.6.4

2014-09-24T09:26:11.776+0800 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910

2014-09-24T09:26:11.777+0800 [initandlisten] build info: Darwin bs-osx108-4 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49

2014-09-24T09:26:11.777+0800 [initandlisten] allocator: system

2014-09-24T09:26:11.777+0800 [initandlisten] options: { storage: { dbPath: "/Users/wangming/Documents/develop/mongodb/data/db" } }

2014-09-24T09:26:11.785+0800 [initandlisten] journal dir=/Users/wangming/Documents/develop/mongodb/data/db/journal

2014-09-24T09:26:11.785+0800 [initandlisten] recover : no journal files present, no recovery needed

2014-09-24T09:26:11.800+0800 [FileAllocator] allocating new datafile /Users/wangming/Documents/develop/mongodb/data/db/local.ns, filling with zeroes...

2014-09-24T09:26:11.800+0800 [FileAllocator] creating directory /Users/wangming/Documents/develop/mongodb/data/db/_tmp

2014-09-24T09:26:11.829+0800 [FileAllocator] done allocating datafile /Users/wangming/Documents/develop/mongodb/data/db/local.ns, size: 16MB,  took 0.029 secs

2014-09-24T09:26:11.899+0800 [FileAllocator] allocating new datafile /Users/wangming/Documents/develop/mongodb/data/db/local.0, filling with zeroes...

2014-09-24T09:26:12.075+0800 [FileAllocator] done allocating datafile /Users/wangming/Documents/develop/mongodb/data/db/local.0, size: 64MB,  took 0.176 secs

2014-09-24T09:26:12.193+0800 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }

2014-09-24T09:26:12.194+0800 [initandlisten] 	 added index to empty collection

2014-09-24T09:26:12.194+0800 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0  reslen:37 394ms

2014-09-24T09:26:12.194+0800 [initandlisten] waiting for connections on port 27017

2014-09-24T09:26:23.841+0800 [initandlisten] connection accepted from 127.0.0.1:50778 #1 (1 connection now open)

2014-09-24T09:26:23.841+0800 [conn1] end connection 127.0.0.1:50778 (0 connections now open)

2014-09-24T09:26:23.994+0800 [initandlisten] connection accepted from 127.0.0.1:50780 #2 (1 connection now open)

2014-09-24T09:26:23.994+0800 [conn2] end connection 127.0.0.1:50780 (0 connections now open)

2014-09-24T09:27:11.814+0800 [clientcursormon] mem (MB) res:33 virt:2653

2014-09-24T09:27:11.814+0800 [clientcursormon]  mapped (incl journal view):160

2014-09-24T09:27:11.814+0800 [clientcursormon]  connections:0

2014-09-24T09:28:13.996+0800 [initandlisten] connection accepted from 127.0.0.1:50789 #3 (1 connection now open)

2014-09-24T09:32:11.887+0800 [clientcursormon] mem (MB) res:33 virt:2653

2014-09-24T09:32:11.887+0800 [clientcursormon]  mapped (incl journal view):160

2014-09-24T09:32:11.887+0800 [clientcursormon]  connections:1

2014-09-24T09:37:11.960+0800 [clientcursormon] mem (MB) res:33 virt:2653

2014-09-24T09:37:11.960+0800 [clientcursormon]  mapped (incl journal view):160

2014-09-24T09:37:11.960+0800 [clientcursormon]  connections:1


    

 4.command+T新建一个终端窗口,在bin文件下输入./mongo指令

      MongoDB shell version: 2.6.4

connecting to: test

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

	http://docs.mongodb.org/

Questions? Try the support group

	http://groups.google.com/group/mongodb-user

Server has startup warnings: 

2014-09-24T09:26:11.776+0800 [initandlisten] 

2014-09-24T09:26:11.776+0800 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000


    

   至此,ok了。

 

mac上安装mongodb数据库教程


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论