防火墙开放了端口27017后,依旧无法访问数据库,使用Studio3T工具报错Connection failed
Connection failed.
SERVER [localhost:27017] (Type: UNKNOWN)
|_/ Connection error (MongoSocketWriteException): Exception sending message
|____/ Socket error: Connection reset
Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {java.net.SocketException: Connection reset}}]
(忘了截图 从别人那里复制来的错误代码
使用命令systemctl stop firewalld关闭防火墙依旧连接不上数据库,但可以ping通
查了好久,终于找到了解决方法
在安全组入方向添加27017端口,之后可以成功连接