Mongodb 7.0.4升级到7.0.29版本测试验证Windows环境
Mongodb近期发布了一个高危漏洞,在生产环境中建议升级到安全版本。在上一次的文章中我们安装部署了一套单节点的mongodb7.0.4版本的数据库(二进制方式)。
现需要把数据库升级到7.0.29版本。由于是小版本之间的升级,只需要覆盖数据库文件即可。
上期文章链接: Mongodb 7.0.4Windows 版本二进制文件安装
升级步骤:
1、下载7.0.29版本的二进制安装包
2、停止mongodb服务
3、覆盖新版本的二进制文件
4、启动数据库
5、检验数据
D:\mongosh-2.6.0-win32-x64\bin>mongosh mongodb://127.0.0.1:27017/admin -u sysadmin -p
Enter password: ******
Current Mongosh Log ID: 6989f879e0aa0d6123628c9f
Connecting to: mongodb://<credentials>@127.0.0.1:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.6.0
Using MongoDB: 7.0.29 <<<<<<<<<<<<
Using Mongosh: 2.6.0
For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/
admin>
检查数据
-->查看集合
admin> use demodb
switched to db demodb
demodb> show collections
students
user
demodb> db.getCollectionNames()
[ 'students', 'user' ]
demodb> db.runCommand({ listCollections: 1, nameOnly: true })
{
cursor: {
id: Long('0'),
ns: 'demodb.$cmd.listCollections',
firstBatch: [
{ name: 'students', type: 'collection' },
{ name: 'user', type: 'collection' }
]
},
ok: 1
}
demodb>
--> 查看集合数据与升级前保持一致。
admin> use demodb
switched to db demodb
demodb> show collections
students
user
demodb> db.getCollectionNames()
[ 'students', 'user' ]
demodb> db.runCommand({ listCollections: 1, nameOnly: true })
{
cursor: {
id: Long('0'),
ns: 'demodb.$cmd.listCollections',
firstBatch: [
{ name: 'students', type: 'collection' },
{ name: 'user', type: 'collection' }
]
},
ok: 1
}
demodb> db.user.find()
[
{
_id: ObjectId('6989f6468b0747a5a4628ca0'),
name: 'Chaitanya',
age: 30
}
]
demodb> db.students.find()
[
{
_id: ObjectId('6989f7798b0747a5a4628ca1'),
StudentId: 1001,
StudentName: 'Steve',
age: 30
},
{
_id: ObjectId('6989f7798b0747a5a4628ca2'),
StudentId: 1002,
StudentName: 'Negan',
age: 42
},
{
_id: ObjectId('6989f7798b0747a5a4628ca3'),
StudentId: 3333,
StudentName: 'Rick',
age: 35
}
]
demodb>