clickhouse安装
2023-01-06 12:30 abce 阅读(477) 评论(0) 编辑 收藏 举报检查当前的CPU是否支持SSE4.2
如果不支持SSE指令集,则不能直接使用先前下载的预编译安装包,需要通过源码编译特定的版本进行安装。
1 | grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" |
clickhouse快速安装
1.下载
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # 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使用的文件和目录的链接。安装最后,会提示为默认用户设置密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # ./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.启动
1 2 3 4 5 6 7 8 9 | # 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.下载和安装脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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
创建目录:
1 2 | # mkdir -p /clickhouse-server/{data,log} # chown -R clickhouse.clickhouse /clickhouse-server/ |
需要修改的地方有:
1 2 3 4 5 6 7 8 9 10 11 | <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> |
修改:
1 2 3 | # 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.重启
1 | clickhouse restart |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
2022-01-06 Autonomous Health Framework(AHF)相关操作
2022-01-06 Oracle Autonomous Health Framework(AHF)
2016-01-06 MySQL-innodb_flush_log_at_trx_commit