文章目录
安装步骤
一、查看环境
1.使用root用户
2.查看自己的centos的版本
cat /etc/redhat-release
二、安装步骤(单机版)
安装前准备
Centos取消打开文件数限制
[root@hadoop103 6]# vim /etc/security/limits.conf
[root@hadoop103 6]# vim /etc/security/limits.d/90-nproc.conf
两个文件到写入进去
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
需要重启服务器使之生效,用ulimit -n 或者 ulimit -a 查看
Centos取消SELINUX
[root@hadoop103 6]# vim /etc/selinux/config
Centos关闭防火墙
[root@hadoop103 6]# service iptables stop
[root@hadoop103 6]# service iptables status
安装依赖
如果报错,多执行几遍
yum install -y *unixODBC*
yum install -y libtool
1.创建文件夹
创建安装文件夹/home/clickhouse/pack/6
[root@hadoop103 ~]# mkdir -p /home/clickhouse/pack/6
2.下载安装包
代码如下(示例):(如果下载老是出错,可以使用mwget语句试试,需要去掉 --content-disposition)
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/6/clickhouse-client-19.7.3.9-1.el6.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/6/clickhouse-common-static-19.7.3.9-1.el6.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/6/clickhouse-server-19.7.3.9-1.el6.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/6/clickhouse-server-common-19.7.3.9-1.el6.x86_64.rpm/download.rpm
完成后的文件夹
3.安装软件
rpm -ivh *rpm
4.启动服务器
service clickhouse-server status
service clickhouse-server start
之前安装过,报错了(Exception: Failed to preprocess config ‘/etc/clickhouse-server/config.xml’: SAXParseException: Tag mismatch in ‘/etc/metrika.xml’, line 33 column 10 (version 19.7.3.1)
)
删除/etc/metrika.xml文件
在启动
ok了
5.启动客户端
clickhouse-client start
卸载clickhouse
有时没有安装好,需要卸载,步骤如下:
检查系统是否支持SSE 4.2:
grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
卸载:
# 卸载及删除安装文件(需root权限)
yum list installed | grep clickhouse
yum remove -y clickhouse-common-static
yum remove -y clickhouse-server-common
rm -rf /var/lib/clickhouse
rm -rf /etc/clickhouse-*
rm -rf /var/log/clickhouse-server
卸载后再次执行就没有
二、安装步骤(联机版)
使任何机器都可以访问clickhouse节点的数据
vim /etc/clickhouse-server/config.xml
3台节点都打开
创建metrika.xml文件
详细可以参考:
ClickHouse学习系列之三【配置文件说明】
[root@hadoop102 etc]# vim /etc/metrika.xml
<yandex>
<clickhouse_remote_servers>
<clickhouse_cluster>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>hadoop102</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>hadoop103</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>hadoop104</host>
<port>9000</port>
</replica>
</shard>
</clickhouse_cluster>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>hadoop102</host>
<port>2181</port>
</node>
<node index="2">
<host>hadoop103</host>
<port>2181</port>
</node>
<node index="3">
<host>hadoop104</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<replica>hadoop102</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>
单机删除的文件,这里需要补起来.再就是启动