Mongodb 集群实战

  该实战过程完全跟着官网一步一步实现 ,官网教程:https://docs.mongodb.com/manual/tutorial/atlas-free-tier-setup/

  使用Mongo Shell连接Cluster

  1. 官网登录,创建免费集群 (补:只能免费一个月,而且有各种限制) ,点击 Build  a New Cluster  按钮,下面是我成功创建Cluster的图。

  2. 设置Mongodb User , 和 IP 白名单,注意IP白名单不是自己网络IP。了解: https://www.imooc.com/qadetail/249703?lastmedia=1





  3. 点击Connect
  4. 选择连接方法,下载对应的连接客户端,此处选择Shell

  5. 下载对应的客户端
  6. 设置环境变量至bin文件夹,不设也ok,但是到时运行程序要在对应路径下运行。
  7. copy 下载命令

  8. 打开cmd窗口 , 连接


    连接成功~ 至于警告,问了问客服回答如下:

    Hi bibi thank you for getting in touch and sending the screenshot.
    The messages displayed in the screenshot can be treated a warnings.
    The warning message that says 'shell and versions do not match' is displayed as you appear to have downloaded version 4.0 of MongoDB (you can see this at the top of the screenshot) and version 3.6.6 of MongoDB Atlas. Rest assured that this is just a notification and version 4.0 of MongoDB and version 3.6.6 of MongoDB Atlas are compatible.
    The message 'user is  not allowed to do action [getlog] on [admin]' appears when you have a free tier (M0) Instance of MongoDB Atlas. The free tier (M0), M2 and M5 Instances have some limitations and command limitations, including limited metrics for analysis. In spite of receiving this message, you should still be able to perform MongoDB CRUD Operations in the shell.
    For example, you can list your database there by entering;
    show dbs
    and create a new database, called test, by entering;
    use test
    You may also find the following MongoDB Atlas article helpful;

    客服态度超级棒!

  9. 操作数据库
    例如:
    MongoDB Enterprise Cluster0-shard-0:PRIMARY> use myNewDB
    switched to db myNewDB
    MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.myNewCollection1.insertOne({x:1})
    {
            "acknowledged" : true,
            "insertedId" : ObjectId("5b63d28b15b047a6f9a9d004")
    }
    MongoDB Enterprise Cluster0-shard-0:PRIMARY>
    

     
    后台看看集合变化

     

 

转载于:https://www.cnblogs.com/bibi-feiniaoyuan/p/9407963.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值