· server · 1 min 阅读
在 openEuler 中使用 mongodb
在 openEuler 中使用 mongodb,并解决 ssh 隧道连接问题。
在 openEuler 中安装 mongodb
- 使用
lscpu查看CPU架构 - 在
https://www.mongodb.com/try/download/community找到对应架构的RedHat系统,复制下载链接 - 使用
wget下载安装包,假设安装包名为mongodb-org-server-7.0.15-1.el8.x86_64.rpm - 使用
sudo dnf install mongodb-org-server-7.0.15-1.el8.x86_64.rpm安装 - 使用
mongod --version查看版本 - 启动并设置为开机自启
sudo systemctl start mongodsudo systemctl enable mongod - 安装
mongosh,sudo dnf install mongodb-mongosh - 查看 mongodb 的状态
sudo systemctl status mongod
安装 Database Tools
- 在
https://www.mongodb.com/try/download/database-tools找到对应架构的RedHat系统,复制下载链接 - 使用
wget下载安装包,假设安装包名为mongodb-database-tools-rhel70-x86_64-100.10.0.rpm - 使用
sudo dnf install mongodb-database-tools-rhel70-x86_64-100.10.0.rpm安装 - 使用
mongorestore恢复数据
修改 mongodb 的绑定地址
- 打开
/etc/mongod.conf - 修改
bindIp内容为0.0.0.0 - 重启 mongodb
sudo systemctl restart mongod
开启 ssh 隧道 TCP 转发功能
- 修改 ssh 的配置项
AllowTcpForwarding为 yes - 重启 ssh
分享:
2