1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| ---------------------------(app)----------------------------------- pm2 stop all
---------------------------(friends)----------------------------------- pm2 stop all
---------------------------(db-old)-----------------------------------
pm2 stop all
service mongod status service mongod stop service mongod start service mongod stop cd /data/db/mongo/ cp -r mongo/ /data/backup/mongodb/mongo-2019-04-28
cd /data/backup/mongodb/ du -sh mongo-2019-04-28/
chown -R user.user /data/backup/mongodb/mongo-2019-04-28
---------------------------(db-m)----------------------------------- cd /data/software/ scp -r -i xxxxxx.pem user@xxx.xxx.xxx.125:/data/backup/mongodb/mongo-2019-04-28 /data/db/ cp /data/db/xxxKey /data/db/mongo/ cd /data/db/mongo/ rm mongod.lock rm WiredTiger.lock rm -rf diagnostic.data/ chown -R mongod.mongod /data/db/mongo/ rm /var/run/mongodb/mongod.pid rm /tmp/mongodb-27017.sock
service mongod start tail -n 500 /data/log/mongo/mongod.log
mongo
use admin;
db.createUser({user:"dba",pwd:"xxxxxx",roles:[{role:"root",db:"admin"},{role:"userAdminAnyDatabase",db:"admin"}]});
vim /etc/mongod.conf
service mongod restart
mongo
use admin; db.auth('dba','xxxxxx');
ReplSet_conf={ _id: "ReplSet", members: [{ _id: 0, host: "xxx.xxx.xxx.150:27017" }, { _id: 1, host: "xxx.xxx.xxx.187:27017" }] }; rs.initiate(ReplSet_conf);
rs.status()
---------------------------(db-s)-----------------------------------
vim /etc/mongod.conf
service mongod start
pm2 start all
---------------------------(app-new)----------------------------------- pm2 start all
切换域名
|