您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān)MongoDB制定路徑登陸創(chuàng)建的方法是什么,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
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ù)庫(kù)目錄
[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.啟動(dòng)的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ù)庫(kù)
[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 <address> 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
如果數(shù)據(jù)庫(kù)不存在,則創(chuàng)建數(shù)據(jù)庫(kù),否則切換到指定數(shù)據(jù)庫(kù)。
switched to db DATABASE_NAME
> use kingscc
switched to db kingscc
> show dbs
( 查看都有什么數(shù)據(jù)庫(kù),里面沒有數(shù)據(jù)的數(shù)據(jù)庫(kù)不顯示)
admin 0.000GB
config 0.000GB
local 0.000GB
> db
(顯示當(dāng)前的數(shù)據(jù)庫(kù))
kingscc
> db.kingscc.insert({"name":"kingscc丶"}) (往數(shù)據(jù)庫(kù)插入數(shù)據(jù))
WriteResult({ "nInserted" : 1 })
> db.dropDatabase() (首先先使用數(shù)據(jù)庫(kù),在進(jìn)行刪除)
{ "dropped" : "kingscc", "ok" : 1 }
> db 刪除當(dāng)前數(shù)據(jù)庫(kù),默認(rèn)為 test,你可以使用 db 命令查看當(dāng)前數(shù)據(jù)庫(kù)名。
kingscc
[END] 2018/12/13 9:55:10
看完上述內(nèi)容,你們對(duì)MongoDB制定路徑登陸創(chuàng)建的方法是什么有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。