今天就跟大家聊聊有關(guān)MongoDB制定路徑登陸創(chuàng)建的方法是什么,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
成都創(chuàng)新互聯(lián)2013年至今,先為大安市等服務(wù)建站,大安市等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為大安市企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
1.下載mongodb的系統(tǒng)包
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.9.tgz
2.解壓壓縮包
[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 模板 文檔 桌面
install.log mongodb-linux-x86_64-3.6.9.tgz 視頻 下載
install.log.syslog 公共的 圖片 音樂
3.將解壓包改名為在
[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.創(chuàng)建數(shù)據(jù)庫目錄
[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.啟動的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.進(jìn)入數(shù)據(jù)庫
[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 IP2018-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
如果數(shù)據(jù)庫不存在,則創(chuàng)建數(shù)據(jù)庫,否則切換到指定數(shù)據(jù)庫。
switched to db DATABASE_NAME
> use kingscc
switched to db kingscc
> show dbs
( 查看都有什么數(shù)據(jù)庫,里面沒有數(shù)據(jù)的數(shù)據(jù)庫不顯示)
admin 0.000GB
config 0.000GB
local 0.000GB
> db
(顯示當(dāng)前的數(shù)據(jù)庫)
kingscc
> db.kingscc.insert({"name":"kingscc丶"}) (往數(shù)據(jù)庫插入數(shù)據(jù))
WriteResult({ "nInserted" : 1 })
> db.dropDatabase() (首先先使用數(shù)據(jù)庫,在進(jìn)行刪除)
{ "dropped" : "kingscc", "ok" : 1 }
> db 刪除當(dāng)前數(shù)據(jù)庫,默認(rèn)為 test,你可以使用 db 命令查看當(dāng)前數(shù)據(jù)庫名。
kingscc
[END] 2018/12/13 9:55:10
看完上述內(nèi)容,你們對MongoDB制定路徑登陸創(chuàng)建的方法是什么有進(jìn)一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。