首页 > 代码库 > mac上安装mongodb数据库教程
mac上安装mongodb数据库教程
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.local2014-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 10002014-09-24T09:26:11.776+0800 [initandlisten] db version v2.6.42014-09-24T09:26:11.776+0800 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee9102014-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_492014-09-24T09:26:11.777+0800 [initandlisten] allocator: system2014-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/journal2014-09-24T09:26:11.785+0800 [initandlisten] recover : no journal files present, no recovery needed2014-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/_tmp2014-09-24T09:26:11.829+0800 [FileAllocator] done allocating datafile /Users/wangming/Documents/develop/mongodb/data/db/local.ns, size: 16MB, took 0.029 secs2014-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 secs2014-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 collection2014-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 394ms2014-09-24T09:26:12.194+0800 [initandlisten] waiting for connections on port 270172014-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:26532014-09-24T09:27:11.814+0800 [clientcursormon] mapped (incl journal view):1602014-09-24T09:27:11.814+0800 [clientcursormon] connections:02014-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:26532014-09-24T09:32:11.887+0800 [clientcursormon] mapped (incl journal view):1602014-09-24T09:32:11.887+0800 [clientcursormon] connections:12014-09-24T09:37:11.960+0800 [clientcursormon] mem (MB) res:33 virt:26532014-09-24T09:37:11.960+0800 [clientcursormon] mapped (incl journal view):1602014-09-24T09:37:11.960+0800 [clientcursormon] connections:1
4.command+T新建一个终端窗口,在bin文件下输入./mongo指令
MongoDB shell version: 2.6.4connecting to: testWelcome 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-userServer 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数据库教程
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。