博文

目前显示的是标签为“Mongodb”的博文

MongoDB study note (2): security configurations - Setup username and password, Bind interface and Iptables (on Ubuntu 16.04/mongoDB 3.4)

Setting up username and password First, check your /etc/mongod.conf to confirm it is not in the auth mode. Add comment symbol '#' of the following code and restart mongod service: #security:   #authorization: enabled sudo service mongod restart Then, Connect to local mongodb: mongo --port 27017 Switch to admin database: use admin Create admin user: db.createUser({ user: "admin", pwd: "<your password>", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] }) Grant Roles: db.grantRolesToUser('admin',[{ role: "root", db: "admin" }]) Check if successfully added (should return 1): db.auth("admin", "<your password>") Exit mongo client: exit Enable the auth mode in your /etc/mongod.conf by activating the following lines and then restart the service: security:   authorization: enabled sudo service mongod restart Go back to...

MongoDB study note (1): Installation and Run (on Ubuntu 16.04/MongoDB 3.4)

Installation Command list: (Ubuntu 16.04 for example. Other systems please refer to https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/) sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list sudo apt-get update sudo apt-get install -y mongodb-org Run Command list: sudo service mongod start