一、ClickHouse JDBC Bridge下载安装RPM包
https://github.com/ClickHouse/clickhouse-jdbc-bridge #github下载地址
rpm -ivh clickhouse-jdbc-bridge-2.1.0-1.noarch.rpm #安装命令
部署包可以直接从笔者的CSDN的下载资源下载!
二、ClickHouse JDBC Bridge 配置
cd /etc/clickhouse-jdbc-bridge/config/datasources #安装成功后自动生成配置路径
根据模板生成配置
touch datasource.json #创建配置文件
{
"$schema": "../datasource.jschema",
"ch-server": {
"aliases": [
"self"
],
"driverUrls": [
"https://repo1.maven.org/maven2/com/clickhouse/clickhouse-jdbc/0.3.2-patch8/clickhouse-jdbc-0.3.2-patch8-http.jar"
],
"driverClassName": "com.clickhouse.jdbc.ClickHouseDriver",
"jdbcUrl": "jdbc:clickhouse://172.18.21.68:8123/system?compress=false",
"username": "default",
"password": "",
"maximumPoolSize": 5
},
"dm-server": {
"aliases": [
"dm"
],
"timezone":"GTM+8",
"converter": {
"mappings": [{ "nativeType": "TIMESTAMP", "toType": "String" },
{ "nativeType": "DATE", "toType": "String" }]
},
"driverUrls": [
"/etc/clickhouse-jdbc-bridge/drivers/DmJdbcDriver18.jar"
],
"driverClassName": "dm.jdbc.driver.DmDriver",
"jdbcUrl": "jdbc:dm://172.18.21.147:5236/NASEN",
"username": "NASEN",
"password": "",
"maximumPoolSize": 100
}
}
{
"$schema": "../datasource.jschema",
"ch-server": {
"aliases": [
"self"
],
"driverUrls": [
"https://repo1.maven.org/maven2/com/clickhouse/clickhouse-jdbc/0.3.2-patch8/clickhouse-jdbc-0.3.2-patch8-http.jar"
],
"driverClassName": "com.clickhouse.jdbc.ClickHouseDriver",
"jdbcUrl": "jdbc:clickhouse://172.18.25.88:8123/system?compress=false",
"username": "default",
"password": "123456",
"maximumPoolSize": 5
},
"dm-server": {
"aliases": [
"dm"
],
"timezone":"GTM+8",
"driverUrls": [
"/etc/clickhouse-jdbc-bridge/drivers/DmJdbcDriver18-8.1.2.141.jar"
],
"driverClassName": "dm.jdbc.driver.DmDriver",
"jdbcUrl": "jdbc:dm://172.18.21.167:5236?SCHEMA=dbname&localTimezone=480",
"username": "nasen",
"password": "123",
"maximumPoolSize": 100
}
上传启动包
cd /etc/clickhouse-jdbc-bridge/drivers
clickhouse-jdbc-0.3.2-patch8-http.jar
dm8-oracle-jdbc16-wrapper.jar
DmJdbcDriver18.jar
笔者把需要这几个驱动包已经放在CSDN的资源下载,直接去我的资源下载直接用!
三、后台启动ClickHouse JDBC Bridge服务
nohup clickhouse-jdbc-bridge > /home/clickhouse-jdbc-bridge.log 2>&1 &
四、clickhouse设置与ClickHouse JDBC Bridge联通配置
cd /etc/clickhouse-server #进到配置路径
vi config.xml #追加配置文件最后
在文件最后追加下面内容
<jdbc_bridge>
<host>172.18.21.141</host>
<port>9019</port>
</jdbc_bridge>
五、clickhouse测试验证
select * from jdbc('', 'show datasources')
select * from jdbc('dm', 'select * from NASEN.NASEN_TEST')
笔者简介
国内某一线知名软件公司企业认证在职员工:任JAVA高级研发工程师,大数据领域专家,数据库领域专家兼任高级DBA!10年软件开发经验!现任国内某大型软件公司大数据研发工程师、MySQL数据库DBA,软件架构师。直接参与设计国家级亿级别大数据项目!并维护真实企业级生产数据库300余个!紧急处理数据库生产事故上百起,挽回数据丢失所造成的灾难损失不计其数!并为某国家级大数据系统的技术方案(国家知识产权局颁布)专利权的第一专利发明人!