MongoDB - Replica Set With Authorization - TR

preview_player
Показать описание
script;

mkdir -p ~/Desktop/mongo-replica/.data1 ~/Desktop/mongo-replica/.data2 ~/Desktop/mongo-replica/.data3
mongod --auth --keyFile ~/Desktop/mongo-replica/mongokey --port 27017 --bind_ip_all --dbpath ~/Desktop/mongo-replica/.data1 --replSet infra & PID1="$!"
mongod --auth --keyFile ~/Desktop/mongo-replica/mongokey --port 27018 --bind_ip_all --dbpath ~/Desktop/mongo-replica/.data2 --replSet infra & PID2="$!"
mongod --auth --keyFile ~/Desktop/mongo-replica/mongokey --port 27019 --bind_ip_all --dbpath ~/Desktop/mongo-replica/.data3 --replSet infra & PID3="$!"

echo "Waiting for the nodes to become ready."

sleep 10 && mongo --port 27017 -u "root" -p "123456" --eval '
{
_id: "infra",
members: [
{ _id: 0, host : "localhost:27017" },
{ _id: 1, host : "localhost:27018" },
{
_id: 2,
host : "localhost:27019",
priority : 0,
slaveDelay: 5,
tags: { slaveDelay: "true" }
}
]
}
)
'
trap "kill $PID1 $PID2 $PID3" exit INT TERM
wait
Рекомендации по теме
Комментарии
Автор

Despite I didnt understand your language, you saved my day with this tutorial. May God bless you.
Thank you so much. Though I used Docker to do implement it, but the concept was taught by you.

Dilinizi anlamamama rağmen, bu eğitimle günümü kurtardınız. Tanrı seni korusun.
Çok teşekkür ederim. Bunu uygulamak için Docker'ı kullanmama rağmen, kavram sizin tarafınızdan öğretildi.

AbiodunSam