美文网首页
mac下安装mongodb

mac下安装mongodb

作者: 牙齿不帅 | 来源:发表于2021-01-05 11:17 被阅读0次
网上很多安装教程,借花献佛了!

1.下载安装包:
官网:https://www.mongodb.com/try/download/community
2.解压gz到 /usr/local/ :

cyldeMacBook-Pro:local neu-cyl$ sudo tar -zxvf mongodb-macos-x86_64-4.4.2.tgz
cyldeMacBook-Pro:local neu-cyl$ mv mongodb-macos-x86_64-4.4.2 mongodb442

3.配置环境变量,~/.bash_profile添加如下:

export PATH=/usr/local/mongodb442/bin:$PATH

4.后台启动运行:

##/usr/local/var/mongodb 数据库文件路径
##/usr/local/var/log/mongodb/mongo.log log路径
cyldeMacBook-Pro:local neu-cyl$ mongod --dbpath /usr/local/var/mongodb --logpath /usr/local/var/log/mongodb/mongo.log --fork

5.查看:

cyldeMacBook-Pro:mongodb442 neu-cyl$ ps -ef|grep mongodb
  501 57259     1   0 11:06上午 ??         0:01.24 mongod --dbpath /usr/local/var/mongodb --logpath /usr/local/var/log/mongodb/mongo.log --fork
  501 57267   477   0 11:06上午 ttys008    0:00.00 grep mongodb

6.进入mongo。

cyldeMacBook-Pro:mongodb442 neu-cyl$ mongo
MongoDB shell version v4.4.2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("08dd029c-042f-4e4b-a60f-7876b1bd1332") }
MongoDB server version: 4.4.2
---
The server generated these startup warnings when booting: 
        2021-01-05T11:06:26.983+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
        2021-01-05T11:06:26.984+08:00: This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip <address> to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning
        2021-01-05T11:06:26.985+08:00: Soft rlimits too low
        2021-01-05T11:06:26.985+08:00:         currentValue: 256
        2021-01-05T11:06:26.985+08:00:         recommendedMinimum: 64000
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).

        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.

        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> 
最后,mongodb4.4版本已经没有了【28017】端口的web界面。所以你访问:http://127.0.0.1:28017 会提示:

It looks like you are trying to access MongoDB over HTTP on the native driver port

相关文章

  • Mac下mongoDB数据库的安装、启动、关闭

    Mac下mongoDB数据库的安装、启动、关闭 一、mongoDB安装 在mac上安装了brew的情况下,可以直接...

  • 数据库/mongodb

    1.MongoDB安装 通过Homebrew 安装MongoDB (Mac OS下) 安装步骤简单,关键在mon...

  • 入门

    安装mongodb mac下 brew install mongodb 启动mongo mongod --conf...

  • Mac下安装MongoDB

    在Mac下安装MongoDB,通过homebrew 1. 通过homebrew安装mongodb $ brew u...

  • python-定向爬虫(极客学院)

    MongoDB 与 Scrapy 1.MongoDB 介绍与安装 参考:mac 下用 brew 安装mongod...

  • mongoDB安装

    mac下安装mongoDB 下载 官网[https://www.mongodb.com/try/download/...

  • Node使用 MongoDB

    最近项目中需要使用MongoDB做数据存储,从安装到简单使用做下记录 Mac安装MongoDB Mac上使用 br...

  • mac系统使用mongodb:安装和启动

    1. 安装mongodb 在mac系统下安装mongodb比较简单,执行命令 brew install mongo...

  • Mac 安装MongoDB

    在Mac上安装MongoDB 在Mac OS上面安装MongoDB,你可以通过编译源代码来安装 ,也可以在Mac ...

  • 在Mac上安装MongoDB

    在Mac上安装MongoDB 在Mac OS上面安装MongoDB,你可以通过编译源代码来安装 ,也可以在Mac ...

网友评论

      本文标题:mac下安装mongodb

      本文链接:https://www.haomeiwen.com/subject/evuioktx.html