首页 > 其他分享 >rpm安装clickhouse(24.11.8.5单机)

rpm安装clickhouse(24.11.8.5单机)

时间:2025-01-17 12:14:55浏览次数:1  
标签:8.5 root pid server clickhouse 24.11 rpm localhost

环境:
OS:Centos 7
db:24.11.8.5

1.下载安装介质
下载地址为:https://packagecloud.io/Altinity/clickhouse
或是这里下载
https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64/

我这里下载的是如下三个包
clickhouse-client-24.8.11.5.noarch.rpm
clickhouse-common-static-24.8.11.5.x86_64.rpm
clickhouse-server-24.8.11.5.noarch.rpm

[root@localhost soft]# mkdir /soft/clickhouse
[root@localhost soft]# cd /soft/clickhouse
[root@localhost soft]#wget https://packages.clickhouse.com/rpm/stable/clickhouse-server-24.8.11.5.x86_64.rpm
[root@localhost soft]#wget https://packages.clickhouse.com/rpm/stable/clickhouse-common-static-24.8.11.5.x86_64.rpm
[root@localhost soft]#wget https://packages.clickhouse.com/rpm/stable/clickhouse-client-24.8.11.5.x86_64.rpm


2.安装
[root@localhost clickhouse]#rpm -ivh clickhouse-common-static-24.8.11.5.x86_64.rpm
[root@localhost clickhouse]#rpm -ivh clickhouse-client-24.8.11.5.x86_64.rpm
[root@localhost clickhouse]#rpm -ivh clickhouse-server-24.8.11.5.x86_64.rpm

这里会提示输入默认的密码,可以直接回车 不需要密码,后面单独对用户进行设置密码

若之前安装了历史版本的,需要进行删除后再安装
[root@localhost clickhouse]# rpm -qa|grep clickhouse
clickhouse-client-21.9.7.2-2.noarch
clickhouse-common-static-21.9.7.2-2.x86_64
clickhouse-server-21.9.7.2-2.noarch

[root@localhost clickhouse]#rpm -e clickhouse-server-21.9.7.2-2.noarch
[root@localhost clickhouse]#rpm -e clickhouse-client-21.9.7.2-2.noarch
[root@localhost clickhouse]#rpm -e clickhouse-common-static-21.9.7.2-2.x86_64

 

3.修改数据目录和日志目录

创建数据目录和日志目录
[root@localhost ~]# mkdir -p /home/middle/clickhouse/data
[root@localhost ~]# mkdir -p /home/middle/clickhouse/log
[root@localhost ~]# chown -R clickhouse:clickhouse /home/middle/clickhouse/

修改数据目录

vi /etc/clickhouse-server/config.xml

原来的
    <!-- Path to data directory, with trailing slash. -->
    <path>/var/lib/clickhouse/</path>
修改为
    <!-- Path to data directory, with trailing slash. -->
    <path>/home/middle/clickhouse/data/</path>

 

修改日志目录

原来的:
        <level>trace</level>
        <log>/var/log/clickhouse-server/clickhouse-server.log</log>
        <errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
修改为:
        <level>trace</level>
        <log>/home/middle/clickhouse/log/clickhouse-server.log</log>
        <errorlog>/home/middle/clickhouse/log/clickhouse-server.err.log</errorlog>

 

4.配置远程登录
[root@localhost clickhouse]#vi /etc/clickhouse-server/config.xml
把下面2行注释去掉,之前是注释的,现在要开启

原来的:
    <!-- Default values - try listen localhost on IPv4 and IPv6. -->
    <!--
    <listen_host>::1</listen_host>
    <listen_host>127.0.0.1</listen_host>
    -->

 

修改为:
    <!-- Default values - try listen localhost on IPv4 and IPv6. -->
    
    <listen_host>::1</listen_host>
    <listen_host>0.0.0.0</listen_host>

 

5.修改允许删除掉任何表和表分区,将如下两行去掉注释,使其生效
[root@localhost clickhouse]#vi /etc/clickhouse-server/config.xml

原来的:
    <!-- <max_table_size_to_drop>0</max_table_size_to_drop> -->
    <!-- <max_partition_size_to_drop>0</max_partition_size_to_drop> -->

 

修改为:
    <max_table_size_to_drop>0</max_table_size_to_drop> 
    <max_partition_size_to_drop>0</max_partition_size_to_drop>

 

6.启动clickhouse-server
centos 7需要使用systemctl启动
systemctl status clickhouse-server.service
systemctl start clickhouse-server.service
systemctl stop clickhouse-server.service

clickhouse默认使用的是9000端口,注意避免端口冲突:
<tcp_port>9000</tcp_port>

 

或是使用如下方式启动或停止

[root@localhost middle]# clickhouse start
 chown -R clickhouse: '/var/run/clickhouse-server/'
Will run sudo --preserve-env -u 'clickhouse' /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid --daemon
Waiting for server to start
Waiting for server to start
Server started

[root@localhost]# clickhouse stop
[root@localhost middle]# clickhouse stop
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 12262.
The process with pid = 12262 is running.
Sent terminate signal to process with pid 12262.
Waiting for server to stop
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 12262.
The process with pid = 12262 is running.
Waiting for server to stop
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 12262.
The process with pid = 12262 is running.
Waiting for server to stop
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 12262.
The process with pid = 12262 is running.
Waiting for server to stop
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 12262.
The process with pid = 12262 is running.
Waiting for server to stop
Now there is no clickhouse-server process.
Server stopped

 

7.登陆
这个时候是免密登录

[root@localhost log]# clickhouse-client -h 192.168.1.134 -m -u default --port=9000
ClickHouse client version 24.8.11.5 (official build).
Connecting to 192.168.1.134:9000 as user default.
Connected to ClickHouse server version 24.8.11.

localhost :) show databases;

SHOW DATABASES

Query id: 012f544b-e900-4c21-9621-f8984b987b36

   ┌─name───────────────┐
1. │ INFORMATION_SCHEMA │
2. │ default            │
3. │ information_schema │
4. │ system             │
   └────────────────────┘

4 rows in set. Elapsed: 0.003 sec. 

localhost :) select version();

SELECT version()

Query id: d3a3f703-7cb2-4354-8686-6275af7409a9

   ┌─version()─┐
1. │ 24.8.11.5 │
   └───────────┘

1 row in set. Elapsed: 0.002 sec. 

 

8.配置默认密码
生成加密密码,我这里明文密码是 clickhouse123 ,对其加密后生成的串如下

[root@localhost log]# echo -n clickhouse123 | openssl dgst -sha256
(stdin)= 2cca9d8714615f4132390a3db9296d39ec051b3faff87be7ea5f7fe0e2de14c9

 

9.修改users.xml配置文件
修改配置文件:/etc/clickhouse-server/users.xml
在默认账号栏目加入如下项<default></default>

<password_sha256_hex>2cca9d8714615f4132390a3db9296d39ec051b3faff87be7ea5f7fe0e2de14c9</password_sha256_hex>

同时注释掉如下项目
<password></password>

<password_sha256_hex> 和 <password> 不能同时出现,最后效果如下:

 

然后重新启动

[root@localhost log]# systemctl stop clickhouse-server.service
[root@localhost log]# systemctl start clickhouse-server.service

尝试使用密码登录:

clickhouse-client -h 192.168.1.134 -m -u default --password clickhouse123
localhost :) select version();

SELECT version()

Query id: 31dc8e72-443c-431b-a505-954e3b9f7666

   ┌─version()─┐
1. │ 24.8.11.5 │
   └───────────┘

1 row in set. Elapsed: 0.002 sec.

 

10.确保默认账号有创建其他用户的权限
more /etc/clickhouse-server/users.xml
确保该栏目设置的值为1,之前版本默认是0的

<access_management>1</access_management>

 

标签:8.5,root,pid,server,clickhouse,24.11,rpm,localhost
From: https://www.cnblogs.com/hxlasky/p/18676651

相关文章

  • digiKam 8.5 (Linux, macOS, Windows) - 开源照片管理软件
    digiKam8.5(Linux,macOS,Windows)-开源照片管理软件ProfessionalPhotoManagementwiththePowerofOpenSource请访问原文链接:https://sysin.org/blog/digikam/查看最新版。原创作品,转载请保留出处。作者主页:sysin.orgdigiKam开源驱动的专业照片管理什么是dig......
  • MySQL备份工具mydumper下载(RPM方式)安装以及详细使用教程
    1、mydumper工具介绍        mydumper是一款社区开源的,用于MySQL数据库的高性能多线程备份工具。与传统的mysqldump相比,mydumper提供了更快的备份和恢复速度,特别是在处理大型数据库时。它包含两个主要工具:•mydumper:负责导出一致的MySQL数据库备份。•myl......
  • 2024.11.20(maven)
    Maven高级特性Maven插件配置在Maven中,插件配置是非常灵活的。你可以为插件定义各种配置参数,以满足项目的需求。org.apache.maven.pluginsmaven-compiler-plugin3.8.11.81.8<!--MavenSurefire插件配置--><plugin><groupId>org.apache.maven......
  • 2024.11.22(Maven 知识总结)
    POM(ProjectObjectModel)是Maven的核心,以xml文件形式存在。它包含了项目的基本信息,如项目坐标(groupId、artifactId、version),用于唯一标识项目。还定义了项目的依赖、插件、构建配置等内容。依赖管理Maven能自动管理项目依赖。通过在pom.xml中声明依赖,它会从中央仓库或其他指定......
  • 2024.11.25(使用SpringBoot实现增删改查)
    创建数据库和表首先,需要创建一个数据库和表,以便进行CRUD操作。例如,使用MySQL创建一个名为user的表,包含id,name,salary等字段。构建项目结构在IDEA中新建一个SpringBoot项目,选择合适的依赖,如SpringWeb,MyBatis,MySQLDriver等。项目通常包含以下结构:Controller层:处理H......
  • 2024.11.26(使用SpringBoot实现增删改查)
    示例代码以下是一个简单的UserController类示例,展示了如何使用SpringBoot进行CRUD操作:@RestController@RequestMapping("/user")publicclassUserController{@AutowiredprivateUserServiceuserService;@GetMapping("/{id}")publicUsergetUser(@PathVariableInteger......
  • 2024.11.27(总结专家的经验)
    第一步,成为互联网时代合格的测试工程师。如果你是入行不满3年的测试工程师,一定对此有迫切需求。此时,你必须具有快速学习的能力,能迅速掌握被测软件的业务功能与内部架构,并在此基础上运用各种测试方法,尽可能多地发现潜在缺陷,并能够在已知缺陷的基础上进一步发现相关的连带缺陷。从......
  • 2024.11.29(总结专家的经验)
    第三步,成为互联网时代的测试架构师。当你经历了各种类型的测试项目,就会发现这些项目本身虽然差异巨大,但是有很多东西是相通的。比如,面对大量测试用例的执行,无论是GUI还是API,都需要一套高效的能够支持高并发的测试执行基础架构;再比如,面对测试过程中的大量差异性数据要求,需要统一......
  • 2024.11.28(总结专家的经验)
    第二步,成为互联网时代优秀的测试工程师。如果你想从“合格”变为“优秀”,那必须先认识到两者的差距在哪里。首先,合格的测试工程师关注的是纯粹的测试,而优秀的测试工程师关注更多的是软件整体的质量,需要根据业务风险以及影响来制定测试策略,有效控制测试的时间和成本,并且能够对测......
  • 2024.11.13(maven)
    Maven的项目结构Maven使用约定优于配置的理念,规定了项目的目录结构。一个标准的Maven项目结构如下:代码语言:javascriptmy-maven-project|--pom.xml|--src||--main|||--java|||--resources||--test||--java||--resources|--t......