clickhouse安装_ClickHouse安装测试

本文详细介绍了在Linux系统上通过DEB、RPM和Tgz包以及Docker安装ClickHouse的步骤,包括启动服务、连接客户端等操作。同时,提供了Docker启动ClickHouse的不同实例配置,并给出了Dockerfile示例。
摘要由CSDN通过智能技术生成

ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS)。

d9a3beb2dbd6ba9f7c67ca2dac026481.png

DEB安装包

sudo apt-get install apt-transport-https ca-certificates dirmngrsudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4echo "deb https://repo.clickhouse.tech/deb/stable/ main/" | sudo tee     /etc/apt/sources.list.d/clickhouse.listsudo apt-get updatesudo apt-get install -y clickhouse-server clickhouse-clientsudo service clickhouse-server startclickhouse-client

RPM安装包

sudo yum install yum-utilssudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPGsudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64sudo yum install clickhouse-server clickhouse-clientsudo systemctl start clickhouse-server

Tgz安装包

export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | head -n 1`curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgzcurl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgzcurl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgzcurl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgztar -xzvf clickhouse-common-static-$LATEST_VERSION.tgzsudo clickhouse-common-static-$LATEST_VERSION/install/doinst.shtar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgzsudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.shtar -xzvf clickhouse-server-$LATEST_VERSION.tgzsudo clickhouse-server-$LATEST_VERSION/install/doinst.shsudo /etc/init.d/clickhouse-server starttar -xzvf clickhouse-client-$LATEST_VERSION.tgzsudo clickhouse-client-$LATEST_VERSION/install/doinst.sh

Docker安装包

1.启动一个server实例

docker run -d --name some-clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server

2.启动一个映射本地卷的server实例

mkdir $HOME/some_clickhouse_database

docker run -d --name some-clickhouse-server --ulimit nofile=262144:262144 --volume=$HOME/some_clickhouse_database:/var/lib/clickhouse yandex/clickhouse-server

3.本地客户端连接

docker run -it --rm --link some-clickhouse-server:clickhouse-server yandex/clickhouse-client --host clickhouse-server

4.Dockerfile文件

FROM ubuntu:18.04ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/"ARG version=19.1.13ARG gosu_ver=1.10RUN apt-get update     && apt-get install --yes --no-install-recommends         apt-transport-https         dirmngr         gnupg     && mkdir -p /etc/apt/sources.list.d     && apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4     && echo $repository > /etc/apt/sources.list.d/clickhouse.list     && apt-get update     && env DEBIAN_FRONTEND=noninteractive         apt-get install --allow-unauthenticated --yes --no-install-recommends             clickhouse-common-static=$version             clickhouse-client=$version             clickhouse-server=$version             libgcc-7-dev             locales             tzdata             wget     && rm -rf         /var/lib/apt/lists/*         /var/cache/debconf         /tmp/*     && apt-get cleanADD https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 /bin/gosuRUN locale-gen en_US.UTF-8ENV LANG en_US.UTF-8ENV LANGUAGE en_US:enENV LC_ALL en_US.UTF-8RUN mkdir /docker-entrypoint-initdb.dCOPY docker_related_config.xml /etc/clickhouse-server/config.d/COPY entrypoint.sh /entrypoint.shRUN chmod +x     /entrypoint.sh     /bin/gosuEXPOSE 9000 8123 9009VOLUME /var/lib/clickhouseENV CLICKHOUSE_CONFIG /etc/clickhouse-server/config.xmlENTRYPOINT ["/entrypoint.sh"]

启动clickhouse-server

1. 服务启动

sudo systemctl start clickhouse-server 或者 sudo /etc/init.d/clickhouse-server start

日志存放/var/log/clickhouse-server/

2.手动从控制台启动服务器:

clickhouse-server --config-file=/etc/clickhouse-server/config.xml

日志前台展示,便于调试

3.本地客户端连接

$ clickhouse-client

$ ./clickhouse-clientClickHouse client version 0.0.18749.Connecting to localhost:9000.Connected to ClickHouse server version 0.0.18749.:) SELECT 1SELECT 1┌─1─┐│ 1 │└───┘1 rows in set. Elapsed: 0.003 sec.:)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值