首页 > 其他分享 >clickhouse安装

clickhouse安装

时间:2023-01-06 12:47:22浏览次数:41  
标签:bin server VERSION usr var 安装 clickhouse

检查当前的CPU是否支持SSE4.2

如果不支持SSE指令集,则不能直接使用先前下载的预编译安装包,需要通过源码编译特定的版本进行安装。

grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

 

clickhouse快速安装

1.下载

# curl https://clickhouse.com/ | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2473    0  2473    0     0   1724      0 --:--:--  0:00:01 --:--:--  1723
 
Will download https://builds.clickhouse.com/master/amd64/clickhouse into clickhouse
 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  502M  100  502M    0     0  2390k      0  0:03:35  0:03:35 --:--:-- 2327k
 
Successfully downloaded the ClickHouse binary, you can run it as:
    ./clickhouse
 
You can also install it:
    sudo ./clickhouse install
 

2.安装

执行install命令,定义clickhouse使用的文件和目录的链接。安装最后,会提示为默认用户设置密码

# ./clickhouse install
Copying ClickHouse binary to /usr/bin/clickhouse.new
Renaming /usr/bin/clickhouse.new to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-server to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-client to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-local to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-benchmark to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-copier to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-obfuscator to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-compressor to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-format to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-extract-from-config to /usr/bin/clickhouse.
Creating clickhouse group if it does not exist.
 groupadd -r clickhouse
Creating clickhouse user if it does not exist.
 useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse clickhouse
Will set ulimits for clickhouse user in /etc/security/limits.d/clickhouse.conf.
Data path configuration override is saved to file /etc/clickhouse-server/config.d/data-paths.xml.
Log path configuration override is saved to file /etc/clickhouse-server/config.d/logger.xml.
User directory path configuration override is saved to file /etc/clickhouse-server/config.d/user-directories.xml.
OpenSSL path configuration override is saved to file /etc/clickhouse-server/config.d/openssl.xml.
Log directory /var/log/clickhouse-server already exists.
Creating data directory /var/lib/clickhouse.
Creating pid directory /var/run/clickhouse-server.
 chown -R clickhouse:clickhouse '/var/log/clickhouse-server'
 chown -R clickhouse:clickhouse '/var/run/clickhouse-server'
 chown  clickhouse:clickhouse '/var/lib/clickhouse'
Enter password for default user:
Password for default user is saved in file /etc/clickhouse-server/users.d/default-password.xml.
Setting capabilities for clickhouse binary. This is optional.
Cannot set 'net_admin' or 'ipc_lock' or 'sys_nice' or 'net_bind_service' capability for clickhouse binary. This is optional. Taskstats accounting will be disabled. To enable taskstats accounting you may add the required capability later manually.
Allow server to accept connections from the network (default is localhost only), [y/N]: y
The choice is saved in file /etc/clickhouse-server/config.d/listen.xml.
 chown -R clickhouse:clickhouse '/etc/clickhouse-server'
 
ClickHouse has been successfully installed.
 
Start clickhouse-server with:
 sudo clickhouse start
 
Start clickhouse-client with:
 clickhouse-client --password

 

3.启动

# clickhouse start
 chown -R clickhouse: '/var/run/clickhouse-server/'
Will run sudo -u 'clickhouse' /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid --daemon
Waiting for server to start
Waiting for server to start
Server started
# clickhouse status
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 6745.
The process with pid = 6745 is running.
 

 

使用TGZ安装包安装

1.下载和安装脚本

LATEST_VERSION=$(curl -s https://packages.clickhouse.com/tgz/stable/ | \
grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | sort -V -r | head -n 1)
export LATEST_VERSION

case $(uname -m) in
x86_64) ARCH=amd64 ;;
aarch64) ARCH=arm64 ;;
*) echo "Unknown architecture $(uname -m)"; exit 1 ;;
esac

for PKG in clickhouse-common-static clickhouse-common-static-dbg clickhouse-server clickhouse-client
do
curl -fO "https://packages.clickhouse.com/tgz/stable/$PKG-$LATEST_VERSION-${ARCH}.tgz" \
|| curl -fO "https://packages.clickhouse.com/tgz/stable/$PKG-$LATEST_VERSION.tgz"
done

tar -xzvf "clickhouse-common-static-$LATEST_VERSION-${ARCH}.tgz" \
|| tar -xzvf "clickhouse-common-static-$LATEST_VERSION.tgz"
sudo "clickhouse-common-static-$LATEST_VERSION/install/doinst.sh"

tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION-${ARCH}.tgz" \
|| tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION.tgz"
sudo "clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh"

tar -xzvf "clickhouse-server-$LATEST_VERSION-${ARCH}.tgz" \
|| tar -xzvf "clickhouse-server-$LATEST_VERSION.tgz"
sudo "clickhouse-server-$LATEST_VERSION/install/doinst.sh" configure
sudo /etc/init.d/clickhouse-server start

tar -xzvf "clickhouse-client-$LATEST_VERSION-${ARCH}.tgz" \
|| tar -xzvf "clickhouse-client-$LATEST_VERSION.tgz"
sudo "clickhouse-client-$LATEST_VERSION/install/doinst.sh"

脚本执行安装过程中,会需要输入设置密码。

 

2.修改数据和日志的目录

默认的数据目录是:/var/lib/clickhouse/

默认的日志目录是:/var/log/clickhouse-server/

配置文件是:/etc/clickhouse-server/config.xml

创建目录:

# mkdir -p /clickhouse-server/{data,log}
# chown -R clickhouse.clickhouse /clickhouse-server/
 

需要修改的地方有:

<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>

<path>/var/lib/clickhouse/</path>
<metadata_path>/var/lib/clickhouse/disks/blob_storage_disk/</metadata_path>
<cache_path>/var/lib/clickhouse/disks/blob_storage_disk/cache/</cache_path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
<path>/var/lib/clickhouse/access/</path>
<!-- <top_level_domains_path>/var/lib/clickhouse/top_level_domains/</top_level_domains_path> -->
<format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>

修改:

# cp /etc/clickhouse-server/config.xml /etc/clickhouse-server/config.xml.bak
# sed -i "s/\/var\/log\/clickhouse-server/\/clickhouse-server\/log/g" /etc/clickhouse-server/config.xml
# sed -i "s/\/var\/lib\/clickhouse/\/clickhouse-server\/data/g" /etc/clickhouse-server/config.xml

3.重启

clickhouse restart

 

标签:bin,server,VERSION,usr,var,安装,clickhouse
From: https://www.cnblogs.com/abclife/p/17026337.html

相关文章

  • centos 7.9 安装zabbix
    一、基础环境1.1查看操作系统版本 cat/etc/redhat-release  1.2关闭防火墙cat/etc/sysconfig/selinux(selinux修改为disable) systemctlstatusfirewall(sys......
  • redhat 9.1 安装docker
    在新主机首次安装DockerEngine-Community之前,需要设置Docker仓库,之后,您可以从仓库安装和更新Docker。设置仓库,需要安装所需的软件包。yum-utils提供了yum-config-man......
  • Windows下安装并设置Redis
    作者: ​​铁锚​​日期:2014年8月10日 ​​Redis​​对于​​Linux​​是官方支持的,安装和使用没有什么好说的,普通使用按照官方指导,5分钟以内就能搞定。详情请参考:​......
  • Arch Linux安装笔记
    ​ 最近有些厌倦Windows,所以想尝试一下Linux,选择Arch的原因不再赘述,建议以ArchLinux官方安装指南为主,这篇笔记只是方便我自己安装而写的,仅供参考。1.安装前的准备1.1腾......
  • 『中级篇』docker的魅力初体验-5分钟安装wordpress不走弯路(三)
    安装截图说话官网安装教程:​​wordpress中文安装教程​​咱们也用docker在一个新的centos虚拟机装一把。光吹说多好没用。开始展示真实的实力的时候了,用我的教程保证5分钟......
  • 『中级篇』在centos上安装docker(九)
    ​在mac和window上都已经安装了docker,这次咱们在linux系统下安装docker。这次也补充下vagrant如何搜索:Vagrantfile如何搜Vagrantfile之前的课程已经已经完成了在windows/mac......
  • Centos7通过yum安装nginx
    安装步骤1.添加nginx到yum源sudorpm-Uvhhttp://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm  2.安装nginxsudo yu......
  • Ubuntu 安装 Redis
    本文档记录使用Ubuntu安装一个生产可用的Redis实例。版本UbuntuUbuntu22.04.1LTSRedis7.0.7如果你正在运行一个非常小的发行版(比如Docker容器......
  • linux安装PHP5.6.30
    原文链接:https://blog.csdn.net/m0_55116875/article/details/121981413前言:当搭建PHP项目时,如果在搭建环境时缺少freetype,会导致访问nginx页面时,登录界面验证码无法成功......
  • docker安装rabbitmq
    创建挂载目录mkdir-p/opt/docker/rabbitmq启动dockerrun-d--restart=always--name=rabbitmq-p5672:5672-p15672:15672\-v/opt/docker/rabbitmq:/var/lib/rab......