zoukankan      html  css  js  c++  java
  • mongodb数据库安装及管理工具mongo-express安装(docker方式)

    环境:centos7

    1、安装mongodb数据库

    docker run --name mongo -p 27017:27017 -v /mymongo/data:/data/db -d mongo
    

    2、新建数据库账号

    [root@localhost ~]# docker exec -it mongo mongo admin
    MongoDB shell version v4.4.1
    connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&gssapiServiceName=mongodb
    Implicit session: session { "id" : UUID("419661b9-51be-47dc-b481-eef25e3c04ad") }
    MongoDB server version: 4.4.1
    Welcome to the MongoDB shell.
    For interactive help, type "help".
    For more comprehensive documentation, see
            https://docs.mongodb.com/
    Questions? Try the MongoDB Developer Community Forums
            https://community.mongodb.com
    ---
    The server generated these startup warnings when booting: 
            2020-10-16T18:30:11.326+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
            2020-10-16T18:30:11.326+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
            2020-10-16T18:30:11.326+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 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()
    ---
    #创建用户密码
    > db.createUser({ user:'admin',pwd:'admin123',roles:[ { role:'userAdminAnyDatabase', db: 'admin'},"readWriteAnyDatabase"]});
    Successfully added user: {
            "user" : "admin",
            "roles" : [
                    {
                            "role" : "userAdminAnyDatabase",
                            "db" : "admin"
                    },
                    "readWriteAnyDatabase"
            ]
    }
    > 
    # 尝试使用上面创建的用户信息进行连接。
    > db.auth('admin', 'admin123')
    1
    

    3、安装管理工具mongo-express

    docker run --link mongo:mongo -p 8081:8081 mongo-express
    

    4、页面查看管理工具http://ip:8081

    做一个决定,并不难,难的是付诸行动,并且坚持到底。
  • 相关阅读:
    NO.05--谈一谈Angular 和 Vue.js 的对比。
    NO.04--我的使用心得之使用vue绑定class名
    No.03---Vue学习之路之模块化组织
    NO.02---聊聊Vue提升
    NO.01---今天聊聊Vuex的简单入门
    hello word!------为什么开通博客以及自我介绍
    JavaScript 常用正则示例
    Newtonsoft.Json(Json.Net)学习笔记
    aspx后台传递Json到前台的两种接收方法
    MVC5中后台提供Json,前台处理Json,绑定给Dropdownlist的例子
  • 原文地址:https://www.cnblogs.com/wukc/p/13840548.html
Copyright © 2011-2022 走看看