clickHouse linux 环境 单机安装 部署

第一步 clickHouse官网查看安装教程
在这里插入图片描述
首先,需要添加官方存储库:

sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64

如果您想使用最新版本,请替换stable为testing(推荐用于您的测试环境)。prestable有时也可用。

然后运行这些命令来安装软件包:

sudo yum install clickhouse-server clickhouse-client

或者手动下载tar包安装
如果使用的是Docker也可以使用Docker镜像安装
都是官网资料非常好用
修改配置/etc/clickhouse-server/config.xml

   
   1、开放远程连接: <listen_host>::</listen_host>
   2、数据目录改为服务器最大的数据盘,如此处是/data2:     
         <!-- Path to data directory, with trailing slash. -->
         <path>/data2/clickhouse/</path>
	 <tmp_path>/data2/clickhouse/tmp/</tmp_path>
	 <user_files_path>/data2/clickhouse/user_files/</user_files_path>
	 <format_schema_path>/data2/clickhouse/format_schemas/</format_schema_path>
 
其他优化配置项修改
 
    配置日志文件切割 (100M做一个切割,ClickHouse存储的已归档日志文件的数量 设置为 10),配置文件:/etc/clickhouse-server/config.xml
       修改如下:
        <size>100M</size>
        <count>10</count>
  
    配置允许的文件导入的错误数(放到<interserver_http_port> 配置项后面):
      <input_format_allow_errors_num>100</input_format_allow_errors_num>
     
    配置连接超时时间参数
       vim /etc/clickhouse-server/config.xml
       修改如下参数:
       <keep_alive_timeout>900</keep_alive_timeout>
       <default_session_timeout>600</default_session_timeout>
        
   是否使用未压缩块的缓存,提升短查询速度。接受01。默认情况下0(禁用),改为1
      修改:<use_uncompressed_cache>0</use_uncompressed_cache><use_uncompressed_cache>1</use_uncompressed_cache>
 
    修改单个查询使用的最大内存限制
      <max_memory_usage>20000000000</max_memory_usage>

配置账号密码: vi /etc/clickhouse-server/users.xml
修改: 将注释打开直接添加一个简单密码也可以使用SHA256加密的密文+明文密码
在这里插入图片描述

安装完成之后就可以启动服务看一下了

sudo service clickhouse-server start

如果没有sevice命令执行

/etc/init.d/clickhouse-server start

或者使用配置文件启动也可以

clickhouse-server --config-file=/etc/clickhouse-server/config.xml

启动后查看服务状态

service clickhouse-server status

使用client 连接服务端查看是否正常或者建表插入数据

clickhouse-client -m --user default --password 123--port 9000

也可以使用IDEA带的数据库工具连接
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值