PDI连接到MongoDB Atlas

问题描述

使用Pentaho Data Integration 9社区版尝试连接到mongodb地图集,但未成功。 尝试了mongodb提供的网址:

mongodb+srv://<username>:<password>@something.XYZ.mongodb.net/<dbname>?retryWrites=true&w=majority

这给了我以下错误:

org.pentaho.mongo.MongoDbException: Malformed host spec: mongodb+srv://<username>:<password>@something.XYZ.mongodb.net/<dbname>?retryWrites=true&w=majority

我看到了一些更改为旧连接字符串的提示,类似于以下内容:

mongodb://user:password@cluster0-shard-00-00-wuhae.mongodb.net:27017,cluster0-shard-00-01-wuhae.mongodb.net:27017,cluster0-shard-00-02-wuhae.mongodb.net:27017/shop?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true

但也没有成功。 有什么想法吗?

解决方法

需要指定副本集,因为它似乎不支持mongodb + srv语法。 因此,就我而言,我必须添加以下内容:

test-shard-00-01.XYZ.mongodb.net,test-shard-00-00.XYZ.mongodb.net,test-shard-00-02.XYZ.mongodb.net

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...