ck 配置 clickhouse-jdbc-bridge

背景

ck可以用过clickhouse-jdbc-bridge技术来直接访问各数据库

安装配置

需要准备的文件

clickhouse-jdbc-bridge

https://github.com/ClickHouse/clickhouse-jdbc-bridge
理论上需要下载源码然后用mavne打包,但提供了打包好的,可以推测用的是maven的shade插件
ck 配置 clickhouse-jdbc-bridge_第1张图片

oracle的驱动

在官网https://mvnrepository.com下载Oracle对应的驱动包ojdbc8-12.2.0.1.jar放置到/data/clickhouse-jdbc-bridge/drivers目录下。
ojdbc8-12.2.0.1.jar 可用于11g

创建目录

sudo mkdir -p /app/clickhouse/clickhouse-jdbc-bridge
sudo chown -R bigdata:bigdata /app

cd /app/clickhouse/clickhouse-jdbc-bridge
mkdir -p config/datasources
mkdir drivers

|–app/clickhouse
|–clickhouse-jdbc-bridge
|–clickhouse-jdbc-bridge-2.0.7-shaded.jar
|–noput.out
|–drivers
|–ojdbc8-12.2.0.1.jar
|–config
|-- datasources
|-- msjdbc.json

nohup java -jar clickhouse-jdbc-bridge-2.1.0-shaded.jar &
tail -f nohup.out

配置文件

cd /app/clickhouse/clickhouse-jdbc-bridge/config/datasources
vim msjdbc.json
{
“msjdbc”: {
“driverUrls”: [
“/app/clickhouse/clickhouse-jdbc-bridge/drivers/ojdbc8-12.2.0.1.jar”
],
“driverClassName”: “oracle.jdbc.driver.OracleDriver”,
“jdbcUrl”: “jdbc:oracle:thin:@10.135.0.70:1521:ods”,
“username”: “账号”,
“password”: “密码”,
“connectionTestQuery”: “”
}
}

connectionTestQuery一定要为空串,不然有可能出问题,oracle好像不支持这么测试

ck的配置

到/etc/clickhouse-server目录下的config.xml文件,找到以下代码,移除注释,并修改host为执行clickhouse-jdbc-bridge-2.10.0-shaded.jar的ip地址:

<jdbc_bridge>
   <host>XX.XX.XX.XXhost>
   <port>9019port>
jdbc_bridge>

使用

启动

nohup java -jar clickhouse-jdbc-bridge-2.1.0-shaded.jar &
tail -f nohup.out

重启ck

systemctl restart clickhouse-server

你可能感兴趣的:(clickhouse)