Clickhouse离线安装教程

server/2024/10/19 9:33:01/

https://blog.51cto.com/u_15060531/4174350

1. 前置

1.1 检查服务器架构

服务器:Centos7.X

需要确保是否x86_64处理器构架、Linux并且支持SSE 4.2指令集

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

如下图所示表示支持

如果输入不支持,需要升级内核版本

1.2 开放防火墙端口

# 查看防火墙状态

firewall-cmd --state

#开放8123端口

firewall-cmd --add-port=8123/tcp --permanent;

# 重新加载防火墙

firewall-cmd --reload;

1.3 关闭SELINUX

#临时关闭
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config

1.4 取消打开文件数限制

编辑/etc/security/limits.conf文件,末尾加入以下内容

cat >> /etc/security/limits.conf <<EOF
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
EOF

然后退出命令行重新连接xshell

1.5 关闭transparent_hugepage

非必须

此配置可以提升数据库性能

cd /usr/lib/tuned/virtual-guest;
# 编辑tuned.conf,在末尾追加如下内容
cat >> tuned.conf <<EOF
[vm]
transparent_hugepage=never
EOF

刷新tuned配置

tuned-adm profile virtual-guest

1.6 下载安装包

下载地址为:https://packages.clickhouse.com/rpm/stable/

国内镜像地址:https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64/

将安装包上传到服务器安装目录

2. 开始安装

2.1 执行如下命令

cd /opt;
rpm -ivh clickhouse-common-static-22.6.3.35.x86_64.rpm;
# 执行clickhouse-server包时会要求输入default用户的密码
rpm -ivh clickhouse-server-22.6.3.35.noarch.rpm;
rpm -ivh clickhouse-client-22.6.3.35.noarch.rpm;

创建相关目录

mkdir -p /packingdata/ck/log;
mkdir -p /packingdata/ck/data;
mkdir -p /packingdata/ck/user_files;

2.2 修改配置文件

在/etc/clickhouse-server/config.d下增加配置文件my.xml,

配置端口号、日志、数据相关的目录

<yandex><listen_host>::</listen_host><logger><log>/packingdata/ck/log/clickhouse-server.log</log><errorlog>/packingdata/ck/log/clickhouse-server.err.log</errorlog></logger><tcp_port>9000</tcp_port><http_port>8123</http_port><path>/packingdata/ck/data/</path><tmp_path>/packingdata/ck/data/tmp/</tmp_path><user_files_path>/packingdata/ck/user_files/</user_files_path><user_directories><local_directory><path>/packingdata/ck/access/</path></local_directory></user_directories>
</yandex>

此处目录配置/packingdata/ck下,因此需要赋予文件夹权限

chown -R clickhouse:clickhouse /packingdata/ck

配置管理权限

编辑/etc/clickhouse-server/users.xml,找到<!-- <access_management>1</access_management> -->

去掉相关注释

2.3 配置自启动

systemctl enable clickhouse-server.service

2.4 启动

systemctl start clickhouse-server.service

2.5 查看启用状态

systemctl status clickhouse-server.service

如下图所示表示启动成功

2.6. 客户端连接

#下面的密码为2.1设置的密码
clickhouse-client -u default --password 123456


http://www.ppmy.cn/server/15929.html

相关文章

如何配置nginx的转发?

配置Nginx的转发可以通过修改Nginx的配置文件来实现。以下是配置Nginx转发的基本步骤&#xff1a; 打开Nginx的配置文件&#xff0c;通常位于/etc/nginx/nginx.conf或/usr/local/nginx/conf/nginx.conf。 在http块中添加一个新的server块&#xff0c;用于配置转发目标的基本信…

ABTest如何计算最小样本量-工具篇

如果是比例类指标&#xff0c;有一个可以快速计算最小样本量的工具&#xff1a; https://www.evanmiller.org/ab-testing/sample-size.html 计算样本量有4个要输入的参数&#xff1a;①一类错误概率&#xff0c;②二类错误概率 &#xff08;一般是取固定取值&#xff09;&…

详细分析mysqlslap的基本知识 | 压力测试(附Demo)

目录 前言1. 基本知识2. 参数解读2.1 auto-generate-sql2.2 only-print2.3 iterations2.4 并发处理参数 前言 对数据库进行压力测试&#xff0c;对此补充这方面的详细知识点 1. 基本知识 mysqlslap 是 MySQL 自带的用于模拟数据库负载的压力测试工具 可以模拟多个客户端并发…

docker环境搭建

项目环境搭建 1、安装 Linux 虚拟机 &#xff08;1&#xff09;下载安装&#xff1a; VM VirtualBox 下载安装&#xff1a;Downloads – Oracle VM VirtualBox&#xff0c;要先开启CPU虚拟化 &#xff08;2&#xff09;通过vagrant&#xff0c;在VirtualBox中安装虚拟机 下…

【Vue】Vue中使一个div铺满全屏

在Vue中实现div全屏铺满的方式与纯CSS实现类似&#xff0c;只是在Vue组件中应用CSS的方式略有不同。 最近在项目开发中&#xff0c;就遇到了这个问题&#xff0c;特此记录一下&#xff0c;方便大伙避坑。 有这么一段代码&#xff1a; <template><div class"fu…

Java,Python和Go语言语法差异对比

前段时间一直在找工作&#xff0c;比较颓废&#xff0c;很长时间都没有更新博客了&#xff0c;最近公司的项目需要用到Python语言和Go语言&#xff0c; 所以又重新学习了一下Python语言和Go语言&#xff0c;现在做一些总结&#xff0c;方便以后复习使用&#xff0c;同时也给其他…

Tomcat设计思路

1. 核心功能 HTTP请求处理&#xff1a;设计一个能够接收HTTP请求并进行分发的核心模块。 Servlet生命周期管理&#xff1a;实现Servlet的生命周期管理&#xff0c;包括初始化、销毁等功能。 线程池支持&#xff1a;为每个HTTP请求分配一个独立的线程&#xff0c;以提高并发处…

【MIT6.824】lab3 Fault-tolerant Key/Value Service 实现笔记

引言 lab3A的实验要求如下&#xff1a; Your first task is to implement a solution that works when there are no dropped messages, and no failed servers. You’ll need to add RPC-sending code to the Clerk Put/Append/Get methods in client.go, and implement Pu…