Clickhouse版本:
21.3.4.25
背景
机器分配不足
单机多实例配置
复制配置文件信息
复制配置文件给新实例使用
sudo cp /etc/clickhouse-server/config.xml /etc/clickhouse-server/config9001.xml
sudo cp /etc/clickhouse-server/user.xml /etc/clickhouse-server/user9001.xml
sudo cp /etc/systemd/system/clickhouse-server.service /etc/systemd/system/clickhouse-server9001.service
sudo cp /etc/metrika.xml /etc/metrika9001.xml
修改配置信息
主要需要修改的配置信息
config9001.xml:
主要第二个实例端口需要跟第一个不一样,其他如有用到的建议也需要更改
<http_port>8123</http_port>
<tcp_port>9001</tcp_port>
<mysql_port>9004</mysql_port>
数据目录、日志目录都需要隔离开
<!-- Path to data directory, with trailing slash. -->
<path>/data/clickhouse/</path>
<!-- Path to temporary data for processing hard queries. -->
<tmp_path>/data/clickhouse/tmp/</tmp_path>
<!-- Directory with user provided files that are accessible by 'file' table function. -->
<user_files_path>/data/clickhouse/user_files/</user_files_path>
集群配置信息也许隔离出来 该文件需根据自己实例配置具体信息
<!-- Path to configuration file with users, access rights, profiles of settings, quotas. -->
<users_config>users.xml</users_config>
<include_from>/etc/metrika8201.xml</include_from>
修改启动配置信息
sudo vi /etc/systemd/system/clickhouse-server9001.service
修改一行即可
/**
ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
*/
改为
ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config9001.xml --pid-file=/run/clickhouse-server/clickhouse-server9001.pid
启动
修改完成之后
启动:
sudo systemctl start clickhouse-server
sudo systemctl start clickhouse-server9001
确认双单机双实例启动成功,且正常时候用,则部署完成