TencentOS Server 3.1安装MongoDB 5.0.8踩坑记录
下载 MongoDB 5.0.8
获取下载地址
官方下载
打开MongoDB官方网站:https://www.mongodb.com/try/download/community

MongoDB服务端x86_64下载直连:x86_64下载直连:https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.8-1.el8.x86_64.rpm
MongoDB客户端x86_64下载直连:https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-shell-5.0.8-1.el8.x86_64.rpm
MongoDB服务端工具x86_64下载直连:https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel80-x86_64-100.5.2.rpm
国内镜像站加速
清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/mongodb/
MongoDB服务端x86_64下载直连:https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el8/RPMS/mongodb-org-server-5.0.8-1.el8.x86_64.rpm
MongoDB客户端x86_64下载直连:https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el8/RPMS/mongodb-org-shell-5.0.8-1.el8.x86_64.rpm
MongoDB服务端工具x86_64下载直连:https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el8/RPMS/mongodb-database-tools-100.5.2.x86_64.rpm
PS:某讯的镜像站只有el7的没有el8的
服务器下载
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el8/RPMS/mongodb-org-server-5.0.8-1.el8.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el8/RPMS/mongodb-org-shell-5.0.8-1.el8.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el8/RPMS/mongodb-database-tools-100.5.2.x86_64.rpm
安装 MongoDB 5.0.8
rpm -ivh mongodb-org-server-5.0.8-1.el8.x86_64.rpm
rpm -ivh mongodb-org-shell-5.0.8-1.el8.x86_64.rpm
dnf install -y mongodb-database-tools-100.5.2.x86_64.rpm



运行 MongoDB 5.0.8
启动命令和常见命令
systemctl start mongod #启动MongoDB
systemctl enable mongod #开机启动MongoDB
systemctl restart mongod #重新启动MongoDB
连接MongoDB
mongo --port 27017

踩的坑
安装完服务端和客户端后使用mongorestore命令提示command not found

通过官网的文档发现
Starting with MongoDB 4.4, mongorestore is now released separately from the MongoDB Server and uses its own versioning, with an initial version of . Previously, mongorestore was released alongside the MongoDB Server and used matching versioning.100.0.0
大意是MongoDB 4.4版本开始mongorestore现在与MongoDB服务器分开发布。所以只安装MongoDB服务端是没有mongorestore