ubuntu 安装最新版 mongodb

前言

由于之前ubuntu自动安装的mongodb版本太低,不支持外部查看。

所以需要装最新版

安装最新的官方地址:https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#uninstall-mongodb-community-edition

 

sudo systemctl restart mongod
sudo systemctl status mongod
cat /var/log/mongodb/mongod.log

 

mkdir -p /data/db#新增数据库
sudo chmod a+w /data/db#给数据库权限

配置文件地址:/etc/mongod.conf

日志文件地址:/var/log/mongodb/mongod.log(可以去配置文件去修改,看看启动日志什么的~~·)

 

如果启动有下面的报错信息:Cannot start server with an unknown storage engine


如果以前装过删除db下所有的文件即可,因为老版本的存储引擎和新版本的存储引擎不一样

----------------------------------------------------------------------------------------------------------------------------------------

2022.10.12更新

数据库被黑客工具了,大无语,要提高安全性

All your data is a backed up. You must pay 0.05 BTC to 12KDdVSHvaB46gGTS7pDiBACyWtx5pv5Hs 48 hours for recover it. After 48 hours expiration we will leaked and exposed all your data. In case of refusal to pay, we will contact the General Data Protection Regulation, GDPR and notify them that you store user data in an open form and is not safe. Under the rules of the law, you face a heavy fine or arrest and your base dump will be dropped from our server! You can buy bitcoin here, does not take much time to buy https://localbitcoins.com or https://buy.moonpay.io/ After paying write to me in the mail with your DB IP: rambler+1jn5p@onionmail.org and/or mariadb@mailnesia.com and you will receive a link to download your database dump.

腾讯云给出的建议:

1)为MongoDB添加认证:MongoDB 启动时添加–auth参数、为MongoDB添加用户认证;

2)MongoDB 自身带有一个HTTP服务和并支持REST接口,在2.6以后这些接口默认是关闭的。MongoDB默认会使用默认端口监听web服务,一般不需要通过web方式进行远程管理,建议禁用。可以修改配置文件设置 nohttpinterface=false

或在启动的时候选择参数 --nohttpinterface。

3)使用云控制台安全组防火墙或本地系统防火墙对访问源IP进行控制,如果仅对内网服务器提供服务,建议勿将 MongoDB服务发布到互联网上。

4)启动时加入参数 --bind_ip 127.0.0.1 或在 /etc/mongodb.conf 文件中添加以下内容:bind_ip = 127.0.0.1,只允许本地访问。

 

 

posted @ 2022-09-16 10:57  深水是沉默  阅读(326)  评论(0编辑  收藏  举报