失效链接处理 |
clickhouse文档 PDF 下载
本站整理下载:
提取码:3ccd
相关截图:
主要内容:
1.安装
1.sudo yum install yum-utils
2.sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
3.sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64
4.sudo yum install clickhouse-server clickhouse-client
5.#启动服务端
6.sudo service clickhouse-server start
7.#启动客户端
8.clickhouse-client
2.账户权限设置
账户设置需要编辑/etc/clickhouse-server/user.xml 文件,在该文件中设置账户权限.
user.xml可以设置用户,访问控制权限和配额Quotas.
具体可以参考文章: https://blog.csdn.net/vkingnew/article/details/107308936. https://clickhouse.tech/docs/zh/operations/settings/settings-users/#access_management-user-setting.
3.多节点安装
Clickhouse分布式安装依赖与Zookeeper, 在安装分布式之前需要先安装好Zookeeper.
以三台机器安装为例. 先在三台机器上安装好clickhouse.再修改/etc/clickhouse-server/config.xml文件.
[root@hadoop102 ~]# vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host>
<!-- <listen_host>::1</listen_host> -->
<!-- <listen_host>127.0.0.1</listen_host> -->
[root@hadoop103 ~]# vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host>
<!-- <listen_host>::1</listen_host> -->
<!-- <listen_host>127.0.0.1</listen_host> -->
[root@hadoop104 ~]# vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host>
<!-- <listen_host>::1</listen_host> -->
<!-- <listen_host>127.0.0.1</listen_host> -->
在三台机器的etc目录下新建metrika.xml文件
<yandex>
<!-- 集群配置 -->
<clickhouse_remote_servers>
<!-- 集群名称 -->
<perftest_3shards_1replicas>
<!-- 数据分片1 -->
<shard>
<weight>1</weight>
<internal_replication>true</internal_replication>
<replica>
<host>bdata01</host>
<port>9000</port>
<user>default</user>
<password>123456</password>
</replica>
</shard>
<!-- 数据分片2 -->
<shard>
<weight>1</weight>
<internal_replication>true</internal_replication>
<replica>
<host>bdata03</host>
<port>9000</port>
<user>default</user>
<password>123456</password>
</replica>
</shard>
<!-- 数据分片3 -->
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>bdata04</host>
<port>9000</port>
<user>default</user>
<password>123456</password>
</replica>
</shard>
</perftest_3shards_1replicas>
</clickhouse_remote_servers>
<!-- ZK -->
<zookeeper-servers>
<node index="1">
<host>bdata01</host>
<port>2181</port>
</node>
<node index="2">
<host>bdata02</host>
<port>2181</port>
</node>
<node index="3">
<host>bdata03</host>
<port>2181</port>
</node>
</zookeeper-servers>
<!-- 本节点副本名称 (这里只配置单副本)-->
<macros>
<layer>01</layer>
<shard>03</shard>
<replica>bdata03</replica>
</macros>
<!-- 监听网络 -->
<networks>
<ip>::/0</ip>
</networks>
<!-- 数据压缩算法 -->
<clickhouse_compression>
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
<method>lz4</method>
</case>
</clickhouse_compression>
</yandex>
4.数据类型
1.整型
固定长度的整型,包括有符号整型或无符号整型。
整型范围(-2n-1~2n-1-1):
Int8 - [-128 : 127]
Int16 - [-32768 : 32767]
Int32 - [-2147483648 : 2147483647]
Int64 - [-9223372036854775808 : 9223372036854775807]
无符号整型范围(0~2n-1):
UInt8 - [0 : 255]
UInt16 - [0 : 65535]
UInt32 - [0 : 4294967295]
UInt64 - [0 : 18446744073709551615]
2.浮点型
Float32 - float
Float64 – double
建议尽可能以整数形式存储数据。例如,将固定精度的数字转换为整数值,如时间用毫秒为单位表示,因为浮点型进行计算时可能引起四舍五入的误差。
与标准SQL相比,ClickHouse 支持以下类别的浮点数:
Inf-正无穷:
-Inf-负无穷:
NaN-非数字:
|