最近升级presto327版本,发现连接mongodb失败:
Query 20191227_140717_01114_j89ju failed: com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized on a0001 to execute command { find: "system.views", filter: { _id: "a0001.test" }, limit: 1, singleBatch: true, $db: "a0001", $clusterTime: { clusterTime: Timestamp(1577455620, 1), signature: { hash: BinData(0, 1DC5A2F8D649567836AC3F0B3CAF1FECCA500EF0), keyId: 6123436269146259457 } }, lsid: { id: UUID("c8a415bc-2234-4d56-8b17-c1fc54ce9d08") } }' on server 192.168.111.12:27017
但是在324、317等版本上面,没有发现该问题,查了一下Mongodb的连接器配置说明:
presto 324:
presto 327:
从presto的说明上看,应该是从327版本开始,连接器配置的@database需要授权,以前版本不需要。查了一下,确实Presto配置连接的账号没有admin库的权限:
db.getUser(“hari”);
给授权:
use admin
db.grantRolesToUser ( "qingfeng", [ { role: "__system", db: "admin" } ] )
问题解决。