日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

docker安装mangoDB

發(fā)布時(shí)間:2023/12/10 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 docker安装mangoDB 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1、docker search mongo 查找鏡像

docker search mongo [root@izbp13y6uttfs3mmgejd5mz ~]# docker search mongo NAME DESCRIPTION STARS OFFICIAL AUTOMATED mongo MongoDB document databases provide high avai… 8123 [OK] mongo-express Web-based MongoDB admin interface, written w… 1037 [OK] tutum/mongodb MongoDB Docker image – listens in port 27017230 [OK] mongoclient/mongoclient Official docker image for Mongoclient, featu… 105 [OK] mongooseim/mongooseim Small docker image for MongooseIM - robust a… 20 cvallance/mongo-k8s-sidecar Kubernetes side car to setup and maintain a … 20 [OK] frodenas/mongodb A Docker Image for MongoDB 19 [OK] arm64v8/mongo MongoDB document databases provide high avai… 15 webhippie/mongodb Docker images for MongoDB 10 [OK] centos/mongodb-32-centos7 MongoDB NoSQL database server 9 istepanov/mongodump Docker image with mongodump running as a cro… 8 [OK] centos/mongodb-36-centos7 MongoDB NoSQL database server 7 centos/mongodb-26-centos7 MongoDB NoSQL database server 5 requilence/mongodb-backup mongo backup container 5 [OK] eses/mongodb_exporter mongodb exporter for prometheus 5 [OK] neowaylabs/mongodb-mms-agent This Docker image with MongoDB Monitoring Ag… 4 [OK] centos/mongodb-34-centos7 MongoDB NoSQL database server 3 andreasleicher/mongo-azure-backup a docker container to backup a mongodb using… 2 [OK] openshift/mongodb-24-centos7 DEPRECATED: A Centos7 based MongoDB v2.4 ima… 1 ekesken/mongo docker image for mongo that is configurable … 1 [OK] ansibleplaybookbundle/mongodb-apb An APB to deploy MongoDB. 1 [OK] ccitest/mongo CircleCI test images for Mongo 0 [OK] phenompeople/mongodb MongoDB is an open-source, document databas… 0 [OK] martel/mongo-replica-ctrl A dockerized controller for a Mongo db repli… 0 [OK] amd64/mongo MongoDB document databases provide high avai… 0

2、拉取mango的鏡像

docker pull mongo [root@izbp13y6uttfs3mmgejd5mz ~]# docker pull mongo Using default tag: latest latest: Pulling from library/mongo 35807b77a593: Pull complete 664b0ebdcc07: Pull complete d598f4d3c081: Pull complete 291455135b00: Pull complete b46409342f13: Pull complete ff2b9c6e6f3a: Pull complete 149f6335fc27: Pull complete baeb6f3bec76: Pull complete 8617caab2de5: Pull complete 067d70de7828: Pull complete Digest: sha256:58ea1bc09f269a9b85b7e1fae83b7505952aaa521afaaca4131f558955743842 Status: Downloaded newer image for mongo:latest docker.io/library/mongo:latest

3、運(yùn)行docker鏡像

docker run --name mongodb -p 27017:27017 -v $PWD/db:/data/db -d mongo:latest [root@izbp13y6uttfs3mmgejd5mz ~]# docker run --name mongodb -p 27017:27017 -v $PWD/db:/data/db -d mongo:latest f0387b871a89f9cfc1a8d13b4a362d3bed9c54f279e449497b3e765938e0712e

4、進(jìn)入docker容器

docker exec -it mongodb mongo admin [root@izbp13y6uttfs3mmgejd5mz ~]# docker exec -it mongodb mongo admin MongoDB shell version v5.0.2 connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("9b1d3c17-b039-49ad-9425-5b23a30101f9") } MongoDB server version: 5.0.2 ================ Warning: the "mongo" shell has been superseded by "mongosh", which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in an upcoming release. We recommend you begin using "mongosh". For installation instructions, see https://docs.mongodb.com/mongodb-shell/install/ ================ Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, seehttps://docs.mongodb.com/ Questions? Try the MongoDB Developer Community Forumshttps://community.mongodb.com --- The server generated these startup warnings when booting: 2021-09-11T08:58:15.092+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem2021-09-11T08:58:15.552+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted2021-09-11T08:58:15.552+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'2021-09-11T08:58:15.552+00:00: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never' --- ---Enable MongoDB's free cloud-based monitoring service, which will then receive and displaymetrics 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 youand anyone you share the URL with. MongoDB may use this information to make productimprovements 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() --- >

5、創(chuàng)建mangodb管理員賬戶

db.createUser({ user: 'admin', pwd: 'syh&cmx******', roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] }); > db.createUser({ user: 'admin', pwd: 'syh&cmx********', roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] }); Successfully added user: {"user" : "admin","roles" : [{"role" : "userAdminAnyDatabase","db" : "admin"}] }

6、對 admin 用戶 進(jìn)行身份認(rèn)證

db.auth("admin","syh&cmx********") > db.auth("admin","syh&cmx********"); 1

7、創(chuàng)建普通的數(shù)據(jù)管理用戶

db.createUser({ user: 'sunyuhua', pwd: 'syh&cmx********', roles: [ { role: "readWrite", db: "app" } ] }); > db.createUser({ user: 'sunyuhua', pwd: 'syh&cmx********', roles: [ { role: "readWrite", db: "app" } ] }); Successfully added user: {"user" : "sunyuhua","roles" : [{"role" : "readWrite","db" : "app"}] }

8、對普通用戶進(jìn)行身份驗(yàn)證

db.auth("sunyuhua","syh&cmx1314"); > db.auth("sunyuhua","syh&cmx1314"); 1

9、使用創(chuàng)建的app數(shù)據(jù)庫進(jìn)行驗(yàn)證

> use app; > db.test.save({name:"sunyhua"}) > db.test.find(); > use app; switched to db app > db.test.save({name:"sunyhua"}) WriteResult({ "nInserted" : 1 }) > db.test.find(); { "_id" : ObjectId("613c7060f832314229fba0dd"), "name" : "sunyhua" } > show collections; test >

10、阿里云機(jī)器安全組添加27017的端口

11、下載一個(gè)可視化管理mangodb的工具

robo3t

12、安裝后查看,測試數(shù)據(jù)

總結(jié)

以上是生活随笔為你收集整理的docker安装mangoDB的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。