Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the method for MongoDB to set the path and login creation?

Shulou Source: shulou.com Published: 2022-05-31 15:44:26 09月14日 Update

Today, I will talk to you about what the MongoDB path landing method is, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

1. Download the system package for mongodb

Wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.9.tgz

two。 Decompress the package

[root@oracle] # tar-zxvf mongodb-linux-x86_64-3.6.9.tgz

[root@oracle ~] # ls

Anaconda-ks.cfg mongodb-linux-x86_64-3.6.9 template document Desktop

Install.log mongodb-linux-x86_64-3.6.9.tgz video download

Install.log.syslog Public Picture Music

3. Rename the unzipped package to the

[root@oracle] # cp-rf mongodb-linux-x86_64-3.6.9 / usr/local/mongodb-3.2

[root@oracle ~] # cd / usr/local/mongodb-3.2/bin/

[root@oracle bin] # ls

Bsondump mongo mongodump mongofiles mongoperf mongorestore mongostat

Install_compass mongod mongoexport mongoimport mongoreplay mongos mongotop

4. Create a database directory

[root@oracle bin] # mkdir-p / data/mongodb/data

[root@oracle bin] # mkdir-p / data/mongodb/logs

[root@oracle bin] # touch / data/mongodb/logs/mongodb.log

[root@oracle bin] # / usr/local/mongodb-3.2/bin/mongod

Mongod mongodump

5. Started MongoDB

[root@oracle bin] # / usr/local/mongodb-3.2/bin/mongod-dbpath=/data/mongodb/data/-logpath=/data/mongodb/logs/mongodb.log-logappend-port=27017-fork

About to fork child process, waiting until server is ready for connections.

Forked process: 23372

Child process started successfully, parent exiting

[root@oracle bin] # ls

Bsondump mongo mongodump mongofiles mongoperf mongorestore mongostat

Install_compass mongod mongoexport mongoimport mongoreplay mongos mongotop

6. Access to the database

[root@oracle bin] #. / mongo

MongoDB shell version v3.6.9

Connecting to: mongodb://127.0.0.1:27017

Implicit session: session {"id": UUID ("c5717a03-56b7-4d69-83cf-434a51542a49")}

MongoDB server version: 3.6.9

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

Http://docs.mongodb.org/

Questions? Try the support group

Http://groups.google.com/group/mongodb-user

Server has startup warnings:

2018-12-13T09:48:46.928+0800 I STORAGE [initandlisten]

2018-12-13T09:48:46.928+0800 I STORAGE [initandlisten] * * WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine

2018-12-13T09:48:46.928+0800 I STORAGE [initandlisten] * * See http://dochub.mongodb.org/core/prodnotes-filesystem

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten]

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * WARNING: Access control is not enabled for the database.

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * Read and write access to data and configuration is unrestricted.

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * WARNING: You are running this process as the root user, which is not recommended.

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten]

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * WARNING: This server is bound to localhost.

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * Remote systems will be unable to connect to this server.

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * Start the server with-bind_ip to specify which IP

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * addresses it should serve responses from, or with-- bind_ip_all to

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * bind to all interfaces. If this behavior is desired, start the

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] * * server with-- bind_ip 127.0.0.1 to disable this warning.

2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten]

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten]

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/enabled is' always'.

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never'

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten]

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/defrag is' always'.

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never'

2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten]

> use DATABASE_NAME

If the database does not exist, create the database, otherwise switch to the specified database.

Switched to db DATABASE_NAME

> use kingscc

Switched to db kingscc

> show dbs

(check what databases are available. Databases with no data in them are not displayed.)

Admin 0.000GB

Config 0.000GB

Local 0.000GB

> db

(show current database)

Kingscc

> db.kingscc.insert ({"name": "kingscc,"}) (insert data into the database)

WriteResult ({"nInserted": 1})

> db.dropDatabase () (use the database first, then delete it)

{"dropped": "kingscc", "ok": 1}

> db deletes the current database. The default is test. You can use the db command to view the current database name.

Kingscc

[END] 2018-12-13 9:55:10

After reading the above, do you have any further understanding of the MongoDB path login creation method? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Data database content method path login command picture document more desktop template directory knowledge article industry video information channel music Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MariaDB Shulou Technology Huawei Redmi