zoukankan      html  css  js  c++  java
  • mongodb 的云数据库产品 atlas 的使用

    前言:最近发现 mlab 被mongodb 收购以后,不再支持新用户,推荐使用 MongoDB Atlas

    第一步:注册或登陆

    在MongoDB atlas首页,如果有账号,那就点击登陆。否则点击Get Started here 来注册,注册页面都是必填项:

    第二步:创建新的Cluster

    登陆之后,如果尚未创建任何Cluster,那么会提示创建一个新的Cluster,如下所示:

    注意 只有M0是免费的,这个里面很多选项都是针对M0以上的,不过M0对于学习也足够了。下面是M0可以设置的选项:

    Cloud Provider & Region:集群部署的位置

    选一个亚洲节点好了。

    Cluster Tier:服务套餐

    当然是M0啦,共享内存 CPU,512M存储也够了,M0包含一个3个节点组成的replica set。

    Additional settings 设置,不过M0没有啥可以设置的

    可以看到,默认是WT引擎,这也表明,MongoDB官方在慢慢放弃Mmapv1存储引擎,大多数新的feature都支持WT引擎。

    Cluster Name: 集群的名字

    点击Create Cluster 开始创建(可能还需要人机校验)

    第三步: 创建用户,设置白名单

    创建新的Cluster需要几分钟时间,在这个等待时间内,可以按提示创建user和设置白名单:

    为了方便访问,白名单IP就设置为0.0.0.0好了

    回到overview界面,集群创建好了,有一些基本的监控:Operation、 Connections、Logical Size

    第四步: 连接试用Cluster

    集群是有了,那怎么连接使用呢,最左边有很多按钮,可以每个点点看看。doc 是 atlas文档的链接, support里面有文档介绍如何链接cluster。

    可以用mongoshell,也可以用mongo driver连接。这里用Mongo shell试试

    step4.1:获取连接URL

    在clusters这个view点击 CONNECT按钮,出现如下

    点击第一个,然后会提示,没有mongodb3.6的话就得装一个

    我本地有mongod3.6 那么点击第二项,这样会给出一个链接的url

    step4.2: 用Mongoshell 连接

    使用mongo shell连接。mongo "mongodb+srv://free-yc5um.mongodb.net/test" --username try

    如下所示:

    mongo "mongodb+srv://free-yc5um.mongodb.net/test" --username try
    MongoDB shell version v3.6.6
    Enter password:
    connecting to: mongodb+srv://free-yc5um.mongodb.net/test
    2018-08-10T13:51:29.072+0800 I NETWORK  [thread1] Starting new replica set monitor for free-shard-0/free-shard-00-00-yc5um.mongodb.net.:27017,free-shard-00-01-yc5um.mongodb.net.:27017,free-shard-00-02-yc5um.mongodb.net.:27017
    2018-08-10T13:51:30.389+0800 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to free-shard-00-02-yc5um.mongodb.net.:27017 (1 connections now open to free-shard-00-02-yc5um.mongodb.net.:27017 with a 5 second timeout)
    2018-08-10T13:51:30.594+0800 I NETWORK  [thread1] Successfully connected to free-shard-00-00-yc5um.mongodb.net.:27017 (1 connections now open to free-shard-00-00-yc5um.mongodb.net.:27017 with a 5 second timeout)
    2018-08-10T13:51:30.811+0800 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to free-shard-00-01-yc5um.mongodb.net:27017 (1 connections now open to free-shard-00-01-yc5um.mongodb.net:27017 with a 5 second timeout)
    2018-08-10T13:51:30.890+0800 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] changing hosts to free-shard-0/free-shard-00-00-yc5um.mongodb.net:27017,free-shard-00-01-yc5um.mongodb.net:27017,free-shard-00-02-yc5um.mongodb.net:27017 from free-shard-0/free-shard-00-00-yc5um.mongodb.net.:27017,free-shard-00-01-yc5um.mongodb.net.:27017,free-shard-00-02-yc5um.mongodb.net.:27017
    2018-08-10T13:51:30.995+0800 I NETWORK  [thread1] Successfully connected to free-shard-00-01-yc5um.mongodb.net.:27017 (1 connections now open to free-shard-00-01-yc5um.mongodb.net.:27017 with a 5 second timeout)
    2018-08-10T13:51:31.191+0800 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to free-shard-00-02-yc5um.mongodb.net:27017 (1 connections now open to free-shard-00-02-yc5um.mongodb.net:27017 with a 5 second timeout)
    2018-08-10T13:51:31.395+0800 I NETWORK  [thread1] Successfully connected to free-shard-00-00-yc5um.mongodb.net:27017 (1 connections now open to free-shard-00-00-yc5um.mongodb.net:27017 with a 5 second timeout)
    MongoDB server version: 3.6.6
    MongoDB Enterprise free-shard-0:PRIMARY> show dbs
    admin  0.000GB
    local  7.142GB
    

    回到MongoDB Atlas管理界面,可以看到,已经有连接了

    至此,就可以免费试用MongoDB3.6了。

    转自:https://www.cnblogs.com/xybaby/p/9460634.html

    .

  • 相关阅读:
    Power Desginer系列00【转载】
    Power Desginer系列02【转载】
    【转】华为路由器、交换机设备模拟器
    【图片教程】大学易站注册发布教程!
    【转】使用BT3、BT4光盘系统、虚拟机vmware破解无线上网
    【技术贴】设置 Eclipse 智能代码提示,大幅度减少 alt+/ 使用频率,打每个字都出现代码提
    【技术贴】ASPNET登录失败。MSsql2005拒绝了对对象 ''xxx'' (数据库 ''xx
    【技术贴】火狐的悬停激活标签扩展插件下载。Tab Focus
    【技术贴】桌面图标变色了怎么办?桌面图标快捷方式失真、模糊的解决办法!
    【转】【CN五一装机版】GhostXP_SP3电脑公司通用版v19.2装机版NTFS
  • 原文地址:https://www.cnblogs.com/crazycode2/p/11094651.html
Copyright © 2011-2022 走看看