手把手教你Excel制作动态模糊匹配的下拉菜单(vba下拉框模糊匹配)
1088
2022-05-29
1 前言
大家好,今天继续向各位分享在华为云上编译和使用ClickHouse,这里会以单节点为例,后续会有系列博文介绍怎样部署集群和使用,欢迎持续关注^_^
2 准备工作
在开始本文之前,建议在华为云购买一台云服务器,同时考虑到后续的顺利操作,云服务器需要有一些要求:
CPU架构:x86计算
规格:c6.2xlarge.4,如果想编译快一点尽量提高CPU的核数
镜像:公共镜像,CentOS CentOS 8.0 64bit
系统盘:高IO,100GB
弹性公网:按流量计费(提高下载速度)
3 操作系统
安装软件包
[root@ecs-dc69 ~]# yum install -y gcc-c++ cmake git
4 编译
4.1 下载ClickHouse代码
[root@ecs-dc69 ~]# git clone https://github.com/ClickHouse/ClickHouse.git [root@ecs-dc69 ~]# cd ClickHouse/ [root@ecs-dc69 ClickHouse]# git checkout -b 20.9 remotes/origin/20.9
4.2 编译gcc-9.3.0
编译ClickHouse需要GCC9及以上的版本,而本机已安装的版本只有GCC8,不能满足:
[root@ecs-dc69 ~]# gcc --version gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
所以需要自行编译安装,这里介绍两种方式:
从ClickHouse代码库触发编译安装
[root@ecs-dc69 ClickHouse]# cd utils/ci [root@ecs-dc69 ci]# vim default-config ... 27 GCC_SOURCES_VERSION=gcc-9.3.0 # or gcc-7.1.0 ...
修改gcc版本信息“latest”为“gcc-9.3.0”,然后编译安装:
[root@ecs-dc69 ci]# ./build-gcc-from-sources.sh
注意:因为编译gcc时间会比较长,如果中间出现网络掉线,建议不要重新执行这个脚本,可以增量继续:
[root@ecs-dc69 ~]# cd ClickHouse/utils/ci/workspace/gcc/gcc-build/ [root@ecs-dc69 gcc-build]# make -j8 && make install
自行下载安装包编译安装
[root@ecs-dc69 ~]# wget https://mirrors.nju.edu.cn/gnu/gcc/gcc-9.3.0/gcc-9.3.0.tar.gz [root@ecs-dc69 ~]# tar xvf gcc-9.3.0.tar.gz [root@ecs-dc69 ~]# cd gcc-9.3.0 [root@ecs-dc69 gcc-9.3.0]# ./contrib/download_prerequisites [root@ecs-dc69 gcc-9.3.0]# mkdir build [root@ecs-dc69 gcc-9.3.0]# cd build [root@ecs-dc69 build]# ../configure --enable-languages=c,c++ --disable-multilib [root@ecs-dc69 build]# make -j8 && make install
另外,如果网络问题无法自动下载gcc的依赖包,可以参考以下几个链接或从其他渠道下载:
[root@ecs-dc69 gcc-9.3.0]# wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [root@ecs-dc69 gcc-9.3.0]# wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [root@ecs-dc69 gcc-9.3.0]# wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [root@ecs-dc69 gcc-9.3.0]# wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2
编译和安装完gcc后,检查下正确性:
[root@ecs-dc69 gcc-build]# which gcc /usr/local/bin/gcc [root@ecs-dc69 gcc-build]# which g++ /usr/local/bin/g++ [root@ecs-dc69 gcc-build]# gcc --version gcc (GCC) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [root@ecs-dc69 gcc-build]# g++ --version g++ (GCC) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [root@ecs-dc69 gcc-build]#
4.3 设置环境变量
[root@ecs-dc69 ~]# export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH [root@ecs-dc69 ~]# export CC=gcc CXX=g++
4.4 编译ClickHouse
下载ClickHouse依赖包:
[root@ecs-dc69 ~]# cd ClickHouse/ [root@ecs-dc69 ClickHouse]# git submodule update --init --recursive
注意:这里如果因为网络问题,也可以自行下载并上传子模块代码(注意子模块代码版本信息),但不要执行上面命令。
[root@ecs-dc69 ClickHouse]# mkdir build && cd build [root@ecs-dc69 build]# cmake ../ [root@ecs-dc69 build]# make -j8
5 测试验证
启动进程
[root@ecs-dc69 build]# ./programs/clickhouse-server
启动客户端
创建1张MergeTree表,然后插入2条记录并读取:
[root@ecs-dc69 build]# ./programs/clickhouse-client --multiline ClickHouse client version 20.9.4.1. Connecting to localhost:9000 as user default. Connected to ClickHouse server version 20.9.4 revision 54439. ecs-dc69 :) ecs-dc69 :) create table table1 ( :-] `EventDate` DateTime, :-] `id` UInt64 :-] ) engine = MergeTree() :-] partition by toYYYYMM(EventDate) :-] order by id; CREATE TABLE table1 ( `EventDate` DateTime, `id` UInt64 ) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY id Ok. 0 rows in set. Elapsed: 0.004 sec. ecs-dc69 :) INSERT INTO table1 VALUES ('2020-01-01 01:01:01', 1); INSERT INTO table1 VALUES Ok. 1 rows in set. Elapsed: 0.004 sec. ecs-dc69 :) INSERT INTO table1 VALUES ('2020-01-01 01:01:02', 2); INSERT INTO table1 VALUES Ok. 1 rows in set. Elapsed: 0.001 sec. ecs-dc69 :) select * from table1; SELECT * FROM table1 ┌───────────EventDate─┬─id─┐ │ 2020-01-01 01:01:01 │ 1 │ └─────────────────────┴────┘ ┌───────────EventDate─┬─id─┐ │ 2020-01-01 01:01:02 │ 2 │ └─────────────────────┴────┘ 2 rows in set. Elapsed: 0.002 sec. ecs-dc69 :)
MapReduce MapReduce服务 EI企业智能 大数据 ClickHouse
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。