work hard work smart

专注于Java后端开发。 不断总结,举一反三。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Clickhouse 单机双实例

Posted on 2021-10-11 10:20  work hard work smart  阅读(633)  评论(0编辑  收藏  举报

一、单机安装

参考:ClickHouse 的安装和使用

 

二、修改配置

logger->log:服务日志存储位置
logger->errorlog:异常日志存储位置
http_port:连接端口号
tcp_port:连接端口号
path:数据存放路径
tmp_path:临时数据的存放路径
user_files_path:用户相关信息的数据
users_config:用户信息配置文件
format_schema_path:表结构数据路径

1、config.xml

cp  /etc/clickhouse-server/config.xml   /etc/clickhouse-server/config2.xml

config.xml

<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<http_port>8123</http_port>
<tcp_port>9000</tcp_port>
<mysql_port>9004</mysql_port>
<interserver_http_port>9009</interserver_http_port>
<path>/var/lib/clickhouse/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
<format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>

 

 

config2.xml

<log>/var/log/clickhouse-server2/clickhouse-server2.log</log>
<errorlog>/var/log/clickhouse-server2/clickhouse-server2.err.log</errorlog>
<http_port>8124</http_port>
<tcp_port>9001</tcp_port>
<mysql_port>9005</mysql_port>
<interserver_http_port>9010</interserver_http_port>
<path>/var/lib/clickhouse2/</path>
<tmp_path>/var/lib/clickhouse2/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse2/user_files/</user_files_path>
<format_schema_path>/var/lib/clickhouse2/format_schemas/</format_schema_path>

 

创建对应的文件夹

1)、  /var/lib/clickhouse2

cd /var/lib

mkdir  clickhouse2

chown -R clickhouse:clickhouse clickhouse2

 

 2)、/var/log/clickhouse-server2

cd /var/log

mkdir clickhouse-server2

chown -R clickhouse:clickhouse clickhouse-server2

 

2、clickhouse-server.service

cp  /etc/systemd/system/clickhouse-server.service   /etc/systemd/system/clickhouse-server2.service

clickhouse-server2.service配置如下:

 

 

 

三、启动

启动实例1   systemctl start  clickhouse-server.service

启动实例2 systemctl start  clickhouse-server2.service