当前位置:网站首页>【clickhouse专栏】单机版的安装与验证
【clickhouse专栏】单机版的安装与验证
2022-06-09 12:35:00 【字母哥博客】
《clickhouse专栏》第三节内容,先安装一个单机版的clickhouse,是后续学习多副本或者分布式集群安装的基础内容。但基本的clickhouse是不依赖于zookeeper的,只有涉及到集群部署的clickhouse才会使用到zookeeper。
一、准备工作
准备工作的部分可能存在不同的linux操作系统发行版,使用的操作命令不一致,但基本上大同小异,大家根据自己的操作系统调整(我使用的是CentOS linux)。
- 在主机防火墙开放clickhouse需要使用的端口(默认为9000),或者关闭防火墙。
firewall-cmd --zone=public --add-port=9000/tcp --permanentfirewall-cmd --reload- CentOS 有文件打开数量的限制,通常需要按照大数据通用做法,将文件打开数配置变大
/etc/security/limits.conf文件的末尾加入以下内容(如果已经存在就修改)
soft nofile 65536hard nofile 65536soft nproc 131072hard nproc 131072- 安装依赖
yum install -y libtool;yum install -y *unixODBC*;CentOS 取消 SELINUX
修改
/etc/selinux/config中的SELINUX=disabled。修改这个配置需要重启,临时生效命令setenforce 0查询状态命令getenforce
二、安装包下载、安装
官网推荐的是使用shell脚本的方式,或者yum 、apt-get的方式来安装。但是这种安装方式需要连接互联网,在很多情况下我们的安装环境没有互联网,或者使用的linux发行版并不一致,导致操作命令不一致。所以通过rpm安装包的方式进行安装就更通用一些。
安装包可以通过这个连接进行下载:https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/,安装包的版本号要一致。如:
- clickhouse-client-21.7.9.7-2.noarch.rpm
- clickhouse-common-static-21.7.9.7-2.x86_64.rpm
- clickhouse-server-21.7.9.7-2.noarch.rpm
规划clickhouse集群的主机,将上面的安装包放入集群统一的规划目录下面。如:/root/clickhouse。然后在集群内每一台主机上该目录下执行命令,则可进行离线安装。
rpm -ivh *.rpm;安装过程会提示输入默认用户密码,输入即可,并记住你的密码 。通过命令rpm -qa|grep clickhouse检查安装结果,结果如下表示安装成功。
clickhouse-common-static-21.7.9.7-2.x86_64clickhouse-client-21.7.9.7-2.noarchclickhouse-server-21.7.9.7-2.noarchrpm安装之后,默认的相关目录为(在安装过程中,会默认新建用户clickhouse,如果你不打算使用默认目录,下文中会提供修改方式。需要注意的是:如果你新建自定义目录,要保证clickhouse用户的读写权限):
- ck脚本目录:/usr/bin/
- ck配置目录:/etc/clickhouse-server/
- /etc/clickhouse-server/config.xml clickhouse的核心配置文件
- ck的数据目录:/var/lib/clickhouse-server
- ck的日志目录:/var/log/clickhouse-server
三、基础配置修改
先通过如下的命令增加配置文件的可修改权限,默认是只读权限。
chmod u+w /etc/clickhouse-server/config.xml- 修改 /etc/clickhouse-server/config.xml。把 listen_host配置的:: 的XML注释打开,这样的话才能让 ClickHouse 被除本 机以外的服务器访问

- 日志配置也在/etc/clickhouse-server/config.xml这个文件中,可以修改日志级别和相关存储目录

- 生产环境下,通常默认的数据存储目录需要修改为独立挂载的磁盘目录

- 修改时区,找到timezone标签,将内容修改为Asia/Shanghai
<timezone>Asia/Shanghai</timezone>四、单机启动及登录验证
- 启动命令:
clickhouse start - 停止命令:
clickhouse stop - 查看clickhouse当前主机节点的状态:systemctl status clickhouse-server
- 客户端连接命令:
clickhouse-client -m,有设置密码的话使用clickhouse-client -m --password Abcd1234 - 直接执行命令
clickhouse-client --password Abcd1234 --query "show databases;" - 在安装了clickhouse client的服务器上远程访问:
clickhouse-client -h 192.168.132.14 --port 9000 -u default --password abcd1234
推荐阅读
限于博文篇幅,更多精彩内容我就不一一列举了,推荐阅读 《原创精品视频及配套文档:springboot-已录制97节(免费)》 等等等等
边栏推荐
- curl post请求携带请求头,传递接送参数数据的命令
- C language queue -- chain queue
- [C language practice - exchange the values of two variables]
- [C language practice - printing diamond and its deformation]
- Common mistakes in data analysis
- 详解异步任务:函数计算的任务触发去重
- [C language practice - printing odd and even digits of integer binary]
- 【C语言练习——交换两个变量的值】
- Record the troubleshooting of high program memory consumption
- How to do data visualization analysis
猜你喜欢

VMware ESXI software 英文版安装步骤

【C语言练习——打印菱形及其变形】

Analysis on the resumption of the most serious downtime in the history of Facebook on October 4, 2021

炒作剽窃、内鬼欺诈 OpenSea上常见的NFT骗局及安全建议

Notes - round square tree

Yunna database monitoring tool, database monitoring operation and maintenance tool
![[C language practice - merging two ordered sequences]](/img/9c/30b9440642381e74f21408883780bd.png)
[C language practice - merging two ordered sequences]

网络空间测绘国内外发展及现状

How to solve the worry of enterprise network with the acceleration of cloud network integration on the third anniversary of 5g licensing?

Network attacks focus on people's livelihood. How can we effectively defend against DDoS and apt attacks?
随机推荐
面试题 08.07. 无重复字符串的排列组合
[signalr complete series] Realization of signalr real-time communication in net core
面试题 08.01. 三步问题
云呐|固定资产归哪个部门管理,归谁管理
[leetcode weekly race record] record of the 79th biweekly race + the 295th weekly race
What are the characteristics of Bi reporting system
浅析网络可视化分析技术
Comment résoudre le problème du réseau d'entreprise en accélérant la fusion du réseau Cloud pour le troisième anniversaire de la licence 5G?
云呐|服务器监控的重要性,监控管理服务器有什么作用
Database day-2
Development and present situation of Network Space Surveying and mapping at home and abroad
[C language practice - printing diamond and its deformation]
What are the types and aspects of Yunna asset management system
面试题 08.08. 有重复字符串的排列组合
2021年10月4日Facebook史上最严重宕机复盘分析
云呐|固定资产管理制度及流程,相关流程
Yunna RFID asset management, advantages of RFID asset management system
Database day-4
C language -- linear list -- double linked list
面试题 08.02. 迷路的机器人