内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

mongodb配置---副本集

MongoDB配置 192.11.11.11 為master節(jié)點
192.11.11.12 為仲裁節(jié)點
192.11.11.13 為備節(jié)點

創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)與策劃設(shè)計,策勒網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:策勒等地區(qū)。策勒做網(wǎng)站價格咨詢:18982081108

1、下載tar包
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.2.tgz

2、解壓
rm -rf /neworiental/mongodb
tar -zxvf /neworiental/tools/mongodb-linux-x86_64-4.0.2.tgz -C /neworiental/
mv /neworiental/mongodb-linux-x86_64-4.0.2 /neworiental/mongodb

3、建立目錄文件夾
mkdir -p /neworiental/mongodb/data/master
mkdir -p /neworiental/mongodb/data/slaver
mkdir -p /neworiental/mongodb/data/arbiter
mkdir -p /neworiental/mongodb/log
mkdir -p /neworiental/mongodb/master
mkdir -p /neworiental/mongodb/slaver
mkdir -p /neworiental/mongodb/arbiter
mkdir /neworiental/mongodb/keyFile/

4、配置文件
addr=/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"
cat <<EOF > /neworiental/mongodb/master/master.conf
#master.conf
dbpath=/neworiental/mongodb/data/master
logpath=/neworiental/mongodb/log/master.log
pidfilepath=/neworiental/mongodb/master.pid
directoryperdb=true
logappend=true
replSet=preferential-mongo
bind_ip=$addr
port=27017
oplogSize=10000
fork=true
noprealloc=true
#auth=true
maxConns=200000
EOF

cat <<EOF > /neworiental/mongodb/slaver/slaver.conf
#slaver.conf
dbpath=/neworiental/mongodb/data/slaver
logpath=/neworiental/mongodb/log/slaver.log
pidfilepath=/neworiental/mongodb/slaver.pid
directoryperdb=true
logappend=true
replSet=preferential-mongo
bind_ip=$addr
port=27017
oplogSize=10000
fork=true
noprealloc=true
#auth=true
maxConns=200000
EOF

cat <<EOF > /neworiental/mongodb/arbiter/arbiter.conf
#arbiter.conf
dbpath=/neworiental/mongodb/data/arbiter
logpath=/neworiental/mongodb/log/arbiter.log
pidfilepath=/neworiental/mongodb/arbiter.pid
directoryperdb=true
logappend=true
replSet=preferential-mongo
bind_ip=$addr
port=27017
oplogSize=10000
fork=true
noprealloc=true
#auth=true
maxConns=200000
EOF

6、分別在master、slaver、arbiter運行相應(yīng)命令,啟動mongodb
/neworiental/mongodb/bin/mongod -f /neworiental/mongodb/master/master.conf #master
/neworiental/mongodb/bin/mongod -f /neworiental/mongodb/slaver/slaver.conf #slaver
/neworiental/mongodb/bin/mongod -f /neworiental/mongodb/arbiter/arbiter.conf #arbiter

7、配置主,備,仲裁節(jié)點
/neworiental/mongodb/bin/mongo 172.22.31.83:27017 #ip和port是某個節(jié)點的地址

use admin

cfg={ _id:"preferential-mongo", members:[
{_id:0,host:'192.11.11.11:27017',priority:2},
{_id:1,host:'192.11.11.13:27017',priority:1},
{_id:2,host:'192.11.11.12:27017',arbiterOnly:true}] };

rs.initiate(cfg) #使配置生效

#如果要添加節(jié)點

rs.add( { host: "ip:27017", priority: 0, votes: 0 }) # 添加節(jié)點

rs.status() #查看狀態(tài),是否生效

出現(xiàn):"stateStr" : "RECOVERING" 表示 沒有生效

#創(chuàng)建密碼驗證

use admin
db.createUser( { user:"preferential", pwd:"preferential",
roles:[{role:"readWriteAnyDatabase",db:"admin"},
{role:"dbAdminAnyDatabase",db:"admin"},
{role:"userAdminAnyDatabase",db:"admin"}] } ) #創(chuàng)建數(shù)據(jù)庫密碼

當(dāng)前文章:mongodb配置---副本集
轉(zhuǎn)載來于:http://www.rwnh.cn/article10/ghdhdo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護定制網(wǎng)站、軟件開發(fā)、定制開發(fā)、面包屑導(dǎo)航、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作
蓬溪县| 尚义县| 新闻| 嘉荫县| 武平县| 韩城市| 高尔夫| 六盘水市| 西乌| 淳安县| 黔南| 常山县| 饶平县| 青川县| 西盟| 万州区| 尼勒克县| 抚宁县| 泾川县| 永德县| 盐源县| 扶余县| 大埔县| 浮梁县| 达州市| 泸州市| 仁怀市| 彰武县| 饶平县| 扬中市| 内黄县| 荣昌县| 樟树市| 长武县| 密云县| 连江县| 永顺县| 伊宁县| 开江县| 舒城县| 都昌县|