《Linux下如何快速搭建MongoDB》要點(diǎn):
本文介紹了Linux下如何快速搭建MongoDB,希望對(duì)您有用。如果有疑問,可以聯(lián)系我們。
相關(guān)主題:非關(guān)系型數(shù)據(jù)庫
在生產(chǎn)環(huán)境中必不可少的有數(shù)據(jù)庫,MongoDB 便是其中之一,它的安裝過程也十分簡(jiǎn)單,可以快速的部署到服務(wù)器,官方定義了MongoDB :
MongoDB 是一個(gè)基于分布式文件存儲(chǔ)的數(shù)據(jù)庫.由 C++ 語言編寫.旨在為 WEB 應(yīng)用提供可擴(kuò)展的高性能數(shù)據(jù)存儲(chǔ)解決方案,是一個(gè)介于關(guān)系數(shù)據(jù)庫和非關(guān)系數(shù)據(jù)庫之間的產(chǎn)品,是非關(guān)系數(shù)據(jù)庫當(dāng)中功能最豐富,最像關(guān)系數(shù)據(jù)庫的
MongoDB
以下為MongoDB 的安裝步驟:
https://www.mongodb.com/download-center#community
vim /etc/profile
寫入一下內(nèi)容
ulimit -f unlimited
ulimit -t unlimited
ulimit -v unlimited
ulimit -n 64000
ulimit -m unlimited
ulimit -u 64000
解壓到指定位置
到解壓位置下新建:
etc/mongodb.conf
fork = true
auth = true
dbpath = /data/mongodb/data
logpath = /data/mongodb/log/mongodb.log
autoresync = true
nohttpinterface=true #不使用http拜訪
/mongo 127.0.0.1/admin –u –p
db.createUser(
{
user: "mongouser",
pwd:"paswd",
roles: [
{ role: "root", db: "admin" }
]
}
)
添加用戶的這個(gè)操作中role: "root"代表的是用戶角色,MongoDB 并不推介用戶使用root用戶,常用角色如下:
readAnyDatabase 對(duì)所有數(shù)據(jù)庫中的collection可讀,同時(shí)包含listDatabases權(quán)限
readWriteAnyDatabase 對(duì)所有數(shù)據(jù)庫中的collection可讀且可寫,同時(shí)包含listDatabases權(quán)限
userAdminAnyDatabase 對(duì)所有數(shù)據(jù)庫擁有userAdmin角色,同時(shí)包含listDatabases權(quán)限
dbAdminAnyDatabase 對(duì)所有數(shù)據(jù)庫擁有dbAdmin角色,同時(shí)包含listDatabases權(quán)限
cluster相關(guān)的權(quán)限 clusterMonitor、hostManager、clusterManager、clusterAdmin
root權(quán)限, 包含 readWriteAnyDatabase, dbAdminAnyDatabase, userAdminAnyDatabase 和 clusterAdmin 等角色. 但不能拜訪system. 開頭的collection(root does not include any access to collections that begin with the system. prefix.)
維易PHP培訓(xùn)學(xué)院每天發(fā)布《Linux下如何快速搭建MongoDB》等實(shí)戰(zhàn)技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養(yǎng)人才。
轉(zhuǎn)載請(qǐng)注明本頁網(wǎng)址:
http://www.snjht.com/jiaocheng/10248.html