【Linux合集】clickhouse單機部署

Unfool發表於2024-11-29

clickhouse單機部署
1、前言

之前由於設定安裝clickhouse預設安裝最新版本發現每次時隔兩天都會因為打滿記憶體導致clickhouse崩潰,
先由於觀察發現24版本穩定,現將版本定格在24.2.1.2248版本

2、安裝clickhouse

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
sudo yum clean all
sudo yum makecache -y
sudo yum install -y clickhouse-server clickhouse-client
sudo yum install clickhouse-server-24.2.1.2248 clickhouse-client-24.2.1.2248

3、配置項修改

## config檔案修改
sudo cp /etc/clickhouse-server/config.xml /etc/clickhouse-server/config.xml.back
sudo chmod 600 /etc/clickhouse-server/config.xml
sudo vi /etc/clickhouse-server/config.xml
# 新增遠端訪問
<listen_host>0.0.0.0</listen_host>    #註釋取消掉
資料儲存目錄
<path>/data/applications/clickhouse/</path>
<tmp_path>/data/applications/clickhouse/tmp/</tmp_path>
​
## users檔案修改
sudo mkdir -pv /data/applications/clickhouse/tmp
sudo chown clickhouse.clickhouse -R /data/applications/clickhouse/
sudo chmod 600 /etc/clickhouse-server/users.xml
# 設定密碼: 
sudo vi /etc/clickhouse-server/users.xml
<password>defaultpass</password>

4、測試連線
二進位制部署測試連線:
clickhouse-client -h 127.0.0.1 --port 9000 -u test_user --password test_password

相關文章