springboot配置MongoDB集群报错:Canonical address IP does not match server address...

MongoDB接入开发程序,springboot配置MongoDB集群报错(前提:linux服务器配置了主机名)
报错:Canonical address IP does not match server address.Removing IP from client view of cluster
原配置:

data:
    mongodb:
      uri: mongodb://192.168.9.145:28017,192.168.9.146:28017,192.168.9.147:28017/nstl?slaveOk=true&replicaSet=rs0&write=1&readPreference=secondaryPreferred&connectTimeoutMS=300000

解决方式:
现配置:

data:
    mongodb:
      uri: mongodb://mongo145:28017,mongo146:28017,mongo147:28017/nstl?slaveOk=true&replicaSet=rs0&write=1&readPreference=secondaryPreferred&connectTimeoutMS=300000

springboot配置MongoDB集群报错:Canonical address IP does not match server address..._第1张图片
重新启动程序即可!

你可能感兴趣的:(MongoDB)