If you have MongoDB 3.x running on docker and you want to upgrade to version 4.x, you cannot re-use the old data volume.
Please follow these steps to achieve upgrading MongoDB=
1. I will assume that you want to upgrade MongoDB from version 3.2 to 4.2
2. You need to incremental upgrade from 3.2 to 3.4, 3.6, 4.0 and then finally 4.2
3. run the following command to upgrade from version 3.2 o 3.4
docker run --name mongo -p 27017:27017 -v /volume:/data/db -d mongo:3.4
4. run the following command to set feature compatibility
docker exec -it mongo bash -c 'mongo --eval "db.adminCommand( { setFeatureCompatibilityVersion: \"3.4\" } )"'
5. repeat steps 3 and 4 three times
- upgrade from 3.4 to 3.6
- upgrade from 3.6 to 4.0
- upgrade from 4.0 to 4.2
6. verify the MongoDB version by running
docker exec -it mongo bash -c 'mongo --version'
credit: https://forums.rocket.chat/t/solved-trying-to-update-mongodb-from-3-2-to-4-0-in-docker-but-errors/3200
ยอดนิยมเดือนนี้
- สูตรหมากฮอส ไม่ว่าจะเป็น การเปิดรูปหมาก การกิน การไล่-หนี หมากกล
- หลักการมีสุขภาพดีแบบง่ายๆ โดย ชาร์ลี มังเกอร์ นักลงทุนหุ้นระดับโลก
- ลงทุน DCA เดือนละ 2,000 - 3,000 บาท ก็มีเงินล้านบาทได้
- วิธีพับดาวกระดาษ สำหรับมือใหม่
- วิธีพับนกกระเรียนกระดาษ สำหรับมือใหม่
- [Update 2026] 11 หุ้นปันผลราชา (Dividend King Stocks) ที่คนไทยคุ้นเลย
- [อัพเดท 2026] หุ้นไทยที่จ่ายเงินปันผลทุกปี ติดต่อกัน 40 ปีขึ้นไป
- 3 Ls (Liquor, ladies and leverage) ภัยร้ายที่ทำให้นักลงทุนล้มละลาย โดย ชาร์ลี มังเกอร์
- หุ้นไทยในชีวิตประจำวัน: การลงทุนที่อยู่รอบตัวเรา
- หนังซีรี่เรื่องวันโลกาวินาศตลาดหุ้น - โดย ดร.นิเวศน์ เหมวชิรวรากร
ไม่มีความคิดเห็น:
แสดงความคิดเห็น