• MongoDB安装与配置(Ubuntu)


    安装

    https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

    1、Import the public key used by the package management system

    wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

    2、Create a list file for MongoDB

    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

    3、Reload local package database

    sudo apt-get update

    4、Install the MongoDB packages

    sudo apt-get install -y mongodb-org

    echo "mongodb-org hold" | sudo dpkg --set-selections
    echo "mongodb-org-database hold" | sudo dpkg --set-selections
    echo "mongodb-org-server hold" | sudo dpkg --set-selections
    echo "mongodb-org-shell hold" | sudo dpkg --set-selections
    echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
    echo "mongodb-org-tools hold" | sudo dpkg --set-selections

    配置

    在客户端mongo中执行创建用户

    use admin
    db.createUser(
    {
    user: admin",
    pwd: passwordPrompt(), // or cleartext password
    roles: [
    { role: "userAdminAnyDatabase", db: "admin" },
    { role: "readWriteAnyDatabase", db: "admin" }
    ]
    }
    )

    在 /etc/mongo.conf中改配置

    security:

        authorization: enable

  • 相关阅读:
    【Mybatis源码解析】Mybatis的日志系统
    20200728
    【Mybatis源码解析】-Configuration
    【日志】怎么打印日志
    【OOM】几种常见的OOM异常
    树 [虚树, 动态规划]
    最大公约数 [动态规划]
    送分题 [组合计数]
    LCM [树状数组, HH的项链]
    AT1219 歴史の研究 [回滚莫队]
  • 原文地址:https://www.cnblogs.com/heysong/p/15582989.html
Copyright © 2020-2023  润新知