MongoDBv7.0.4不支持ipv6訪問
錯誤描述
報錯如下描述
Cannot connect to MongoDB.No suitable servers found:
serverSelectionTimeoutMS` expired: [failed to resolve 2408]
問題分析
首先確定其是否支持ipv6網(wǎng)絡(luò)
[root@192 ~]# netstat -ntulp |grep 27017
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 26689/mongod
tcp6 0 0 :::27017 :::* LISTEN 26689/mongod
不支持的話修改器配置文件如下所示
net:
port: 27017
bindIpAll: true
ipv6: true
processManagement:
fork: true
pidFilePath: /www/server/mongodb/log/configsvr.pid
security:
authorization: enabled
javascriptEnabled: false
storage:
dbPath: /www/server/mongodb/data
directoryPerDB: true
systemLog:
destination: file
logAppend: true
path: /www/server/mongodb/log/config.log
查看服務(wù)器是否開啟防火墻權(quán)限
# 開放指定端口(防火墻重啟后生效)
firewall-cmd --zone=public --add-port=27017/tcp --permanent
# 重啟防火墻
firewall-cmd --reload
錯誤原因
原因1:配置文件
net:
port: 27017
bindIpAll: true
ipv6: true
原因2:服務(wù)器防火墻
原因3:navicat中,訪問地址需要加中括號文章來源:http://www.zghlxwxcb.cn/news/detail-836088.html
解決方式
在navicat中,需要加中括號文章來源地址http://www.zghlxwxcb.cn/news/detail-836088.html
到了這里,關(guān)于[服務(wù)器-數(shù)據(jù)庫]MongoDBv7.0.4不支持ipv6訪問的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!