标签:tor code repos 不同 epo tcl debian str mysql
sudo apt-get install dirmngr sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list sudo apt-get update sudo apt-get install -y clickhouse-server clickhouse-client sudo service clickhouse-server start clickhouse-client
参考:https://github.com/Altinity/clickhouse-rpm-install
#step 1
#先下载安装脚本
curl -s https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh | sudo bash
#可以指定系统版本
curl -s https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh | sudo os=centos dist=7 bash
#这里注意,我当时指定错了系统版本,导致找不到libstdc++的依赖包,汗颜!!
#step 2
#查看库里clickhouse相关的包
sudo yum list ‘clickhouse*‘
#step 3
#安装核心的服务和客户端
sudo yum install -y clickhouse-server clickhouse-client
#step 4
#启动服务
service clickhouse-server start
#step 5
#启动客户端
clickhouse-client
maven 依赖
<dependency> <groupId>ru.yandex.clickhouse</groupId> <artifactId>clickhouse-jdbc</artifactId> <version>0.1.54</version> </dependency>
java代码
JDBC Driver Class: ru.yandex.clickhouse.ClickHouseDriver
和mysql不同,不需要先Class.forName();加载drive;
应为我没有配置账号密码,所以直接给个url就可以创建链接,代码如下:
public static Connection getClickHouseConnection() throws SQLException { String url="jdbc:clickhouse://ip:8123/dataBaseName"; ClickHouseDataSource dataSou=new ClickHouseDataSource(url); return dataSou.getConnection(); }
附:Clickhouse官方文档 https://clickhouse.yandex/docs/zh/
标签:tor code repos 不同 epo tcl debian str mysql
原文地址:https://www.cnblogs.com/yanghaolie/p/11060572.html