Clickhouse的极简安装-之二(macos+linux)

clickhouse,安装,之二,macos,linux · 浏览次数 : 23

小编点评

**Clickhouse 安装步骤 (macOS+Linux)** 1. 下载 ClickHouse 二进制文件: ``` wget https://builds.clickhouse.com/master/amd64/clickhouse ``` 2. 将 ClickHouse 二进制文件放到 `/usr/bin` 目录下: ``` sudo mv clickhouse /usr/bin/clickhouse ``` 3. 创建 ClickHouse 用户并设置 ulimits: ``` sudo useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse clickhouseWill set ulimits for clickhouse user in /etc/security/limits.d/clickhouse.conf.Creating config directory /etc/clickhouse-server.Creating config directory /etc/clickhouse-server/config.d that is used for tweaks of main server configuration.Creating config directory /etc/clickhouse-server/users.d that is used for tweaks of users configuration.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.Creating log directory /var/log/clickhouse-server.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' ``` 4. 设置默认用户名和密码: ``` sudo chpasswd default ``` 5. 启动 ClickHouse 服务: ``` sudo clickhouse start ``` 6. 启动 ClickHouse 客户端: ``` sudo clickhouse client ```

正文

Clickhouse的极简安装-之二(macos+linux)


StudyFrom

https://clickhouse.com/docs/en/install

然后简单的获取方式:
curl https://clickhouse.com/  > ck.url

其实可以看到他的安装命令了. 

命令拆解

if [ "${OS}" = "Linux" ]
then
    if [ "${ARCH}" = "x86_64" -o "${ARCH}" = "amd64" ]
    then
        # Require at least x86-64 + SSE4.2 (introduced in 2006). On older hardware fall back to plain x86-64 (introduced in 1999) which
        # guarantees at least SSE2. The caveat is that plain x86-64 builds are much less tested than SSE 4.2 builds.
        HAS_SSE42=$(grep sse4_2 /proc/cpuinfo)
        if [ "${HAS_SSE42}" ]
        then
            DIR="amd64"
        else
            DIR="amd64compat"
        fi
    elif [ "${ARCH}" = "aarch64" -o "${ARCH}" = "arm64" ]
    then
        # If the system has >=ARMv8.2 (https://en.wikipedia.org/wiki/AArch64), choose the corresponding build, else fall back to a v8.0
        # compat build. Unfortunately, the ARM ISA level cannot be read directly, we need to guess from the "features" in /proc/cpuinfo.
        # Also, the flags in /proc/cpuinfo are named differently than the flags passed to the compiler (cmake/cpu_features.cmake).
        HAS_ARMV82=$(grep -m 1 'Features' /proc/cpuinfo | awk '/asimd/ && /sha1/ && /aes/ && /atomics/ && /lrcpc/')
        if [ "${HAS_ARMV82}" ]
        then
            DIR="aarch64"
        else
            DIR="aarch64v80compat"
        fi
    elif [ "${ARCH}" = "powerpc64le" -o "${ARCH}" = "ppc64le" ]
    then
        DIR="powerpc64le"
    elif [ "${ARCH}" = "riscv64" ]
    then
        DIR="riscv64"
    elif [ "${ARCH}" = "s390x" ]
    then
        DIR="s390x"
    fi
elif [ "${OS}" = "FreeBSD" ]
then
    if [ "${ARCH}" = "x86_64" -o "${ARCH}" = "amd64" ]
    then
        DIR="freebsd"
    fi
elif [ "${OS}" = "Darwin" ]
then
    if [ "${ARCH}" = "x86_64" -o "${ARCH}" = "amd64" ]
    then
        DIR="macos"
    elif [ "${ARCH}" = "aarch64" -o "${ARCH}" = "arm64" ]
    then
        DIR="macos-aarch64"
    fi
fi

二进制的洗洗

明显可以看到, 安装文件
linux 如果是x86架构:  amd64 
      如果没有SSE42那么就是: amd64compat
linux 如果arm架构:    aarch64
      如果是飞腾架构:  aarch64v80compat
macos 如果是x86的机器: macos
      如果是m2的机器:  macos-aarch64

获取精确的下载地址

https://builds.clickhouse.com/master/${DIR}/clickhouse

然后进行替换就可以了. 
比如 linux机器的话 就是:
wget https://builds.clickhouse.com/master/amd64/clickhouse

linux的话可以直接使用命令或者是二进制进行安装

安装方式

将 clickhouse 二进制文件放到 /usr/bin 目录下
执行clickhouse install 就可以. 

注意事项

最新的latest 的clickhouse 的二进制无法再鲲鹏上面运行
需要降级处理一下:
一般可以从如下网站进行下载 tar.gz包 
https://repo.clickhouse.tech/tgz/stable/

需要注意 一般进需要 static 的那个包里面的clickhouse 文件.
与上一步安装方式完全一样. 
1. 分发文件
scp /usr/bin/clickhouse root@192.168.255.64:/usr/bin/
2. 安装
clickhouse install
3. 测试验证
clickhouse-local -q "select 1"
1

注意安装的效果为:

ClickHouse binary is already located at /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-git-import 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 symlink /usr/bin/clickhouse-keeper to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-keeper-converter to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-disks 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.
Creating config directory /etc/clickhouse-server.
Creating config directory /etc/clickhouse-server/config.d that is used for tweaks of main server configuration.
Creating config directory /etc/clickhouse-server/users.d that is used for tweaks of users configuration.
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.
Creating log directory /var/log/clickhouse-server.
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 empty string. See /etc/clickhouse-server/users.xml and /etc/clickhouse-server/users.d to change it.
Setting capabilities for clickhouse binary. This is optional.
 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

与Clickhouse的极简安装-之二(macos+linux)相似的内容:

Clickhouse的极简安装-之二(macos+linux)

# Clickhouse的极简安装-之二(macos+linux) ## StudyFrom ``` https://clickhouse.com/docs/en/install 然后简单的获取方式: curl https://clickhouse.com/ > ck.url 其实可以看到他的安装命

Clickhouse 极简单机版本安装部署

# Clickhouse 极简单机版本安装部署 ## 摘要 ``` Clickhouse的安装与部署其实比较简单. 但是为了能够更加简单的部署与使用. 尤其是能够可以方便的添加到镜像内进行运行. 所以记录一下方便快捷的处理方式. ``` ## 下载与使用的坑 ``` 1. 最新版本的 clickho

Clickhouse表引擎探究-ReplacingMergeTree

作者:耿宏宇 1 表引擎简述 1.1 官方描述 MergeTree 系列的引擎被设计用于插入极大量的数据到一张表当中。数据可以以数据片段的形式一个接着一个的快速写入,数据片段在后台按照一定的规则进行合并。相比在插入时不断修改(重写)已存储的数据,这种策略会高效很多。 ReplacingMergeTr

文盘Rust -- 本地库引发的依赖冲突

clickhouse 的原生 rust 客户端目前比较好的有两个clickhouse-rs 和 clickhouse.rs 。两个库在单独使用时没有任何问题,但是,在同一工程同时引用时会报错。本篇内容主要讲解如何用rust语言解决本地库引发的依赖冲突问题

[转帖]clickhouse使用clickhouse-keeper代替zookeeper

目录 异常现象: 1. clickhouse的异常日志 2. 追踪对应节点的zookeeper日志 使用clickhouse-keeper代替 zookeeper的步骤: 1: 准备 clickhouse-keeper的配置文件 1.1- 设置通信地址,以便对外通信 1.2- 在config.xml

基于OpenJDK部署clickhouse-local镜像的快捷方法

# 基于OpenJDK部署clickhouse-local镜像的快捷方法 ## 摘要 ``` 前期搭建了一套基于OpenJDK的Clickhouse的服务端的镜像 可以简单使用dbeaver进行连接与使用. 后来发现需求与自己理解的不一样. 更加需要的是一套使用clickhouse-local 进行

万字长文详述ClickHouse在京喜达实时数据的探索与实践

在引入ClickHouse过程中经历各种困难,耗费大量精力去探索并一一解决,在这里记录一下希望能够给没有接触过ClickHouse的同学提供一些方向上的指引避免多走弯路,如果文中有错误也希望多包含给出指点,欢迎大家一起讨论ClickHouse相关的话题。本文偏长但全是干货,请预留40~60分钟进行阅读。

[转帖]9.2 TiFlash 架构与原理

9.2 TiFlash 架构与原理 相比于行存,TiFlash 根据强 Schema 按列式存储结构化数据,借助 ClickHouse 的向量化计算引擎,带来读取和计算双重性能优势。相较于普通列存,TiFlash 则具有实时更新、分布式自动扩展、SI(Snapshot Isolation)隔离级别读

稳定、省钱的 ClickHouse 读写分离方案:基于 JuiceFS 的主从架构实践

Jerry 是一家位于北美的科技公司,利用人工智能和机器学习技术,简化汽车保险和贷款的比价和购买流程。在美国,Jerry 的应用在其所属领域排名第一。 随着数据规模的增长,Jerry 在使用 AWS Redshift 时遇到了一些性能与成本的挑战。Jerry 重新设计了系统架构,使用 ClickHo

ClickHouse数据表迁移实战之-remote方式

ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS)。我们内部很多的报表、数据看板都基于它进行开发。今天为大家带来remote方式的ClickHouse数据表迁移的完整过程介绍,如有错误,还请各位大佬指正。