【Clickhouse 映射 MongoDB】- 用标准SQL查询数据(不支持写入)


MongoDB上创建一个只读账号

use yourDB
db.createUser({user:"rd",pwd:"123456",roles:[{role:"read",db:"test"}]})


Clickhouse创建映射表

CREATE TABLE t1  \
(  \
    id UInt64,  \
    name String,  \
	info String  \
) ENGINE = MongoDB('192.168.176.204:37017', 'test', 't1', 'rd', '123456');

注:test是库名,t1是表名

或者直接查也行。

SELECT * FROM mongodb(  \
    '192.168.176.204:37017',  \
    'test',  \
    't1',  \
    'rd',  \
    '123456',  \
    'id UInt64, name String, info String',  \
    'connectTimeoutMS=10000'   \
)

【Clickhouse 映射 MongoDB】- 用标准SQL查询数据(不支持写入)_SQL

【Clickhouse 映射 MongoDB】- 用标准SQL查询数据(不支持写入)_mongodb_02