Clickhouse

將 Clickhouse 數據目錄掛載到另一個分區:DB::Exception: Settings profile default not found

  • June 15, 2021

我正在嘗試將 clickhouse 數據目錄移動到另一個分區/dev/sdb1。所以這就是我所做的:

sudo systemctl stop clickhouse-server
mv /var/lib/clickhouse /var/lib/clickhouse-orig
mkdir /var/lib/clickhouse
chown clickhouse:clickhouse /var/lib/clickhouse
mount -o user /dev/sdb1 /var/lib/clickhouse 
cp -Rv /var/lib/clickhouse-orig/* /var/lib/clickhouse/
chown -Rv clickhouse:clickhouse /var/lib/clickhouse
sudo systemctl start clickhouse-server

但它在啟動時顯示錯誤:

Processing configuration file '/etc/clickhouse-server/config.xml'.
Sending crash reports is disabled
Starting ClickHouse 21.6.4.26 with revision 54451, build id: 12B138DBA4B3F1480CE8AA18884EA895F9EAD439, PID 10431
starting up
OS Name = Linux, OS Version = 5.4.0-1044-gcp, OS Architecture = x86_64
Calculated checksum of the binary: 26864E69BE34BA2FCCE2BD900CF631D4, integrity check passed.
Setting max_server_memory_usage was set to 882.18 MiB (980.20 MiB available * 0.90 max_server_memory_usage_to_ram_ratio)
DB::Exception: Settings profile `default` not found
shutting down
Stop SignalListener thread

EDIT 顯然即使沒有新分區它也不會啟動,所以可能 theconfig.xml或 themacro.xml是罪魁禍首

檢查 /var/lib/clickhouse/preprocessed_configs/users.xml 文件,它應該包含 XPath /yandex/profiles/default

apt-get install -y libxml2-utils
xmllint --xpath /yandex/profiles/default /var/lib/clickhouse/preprocessed_configs/users.xml

另外,查看源配置/etc/clickhouse-server/users.xml和可能的/etc/clickhouse-server/users.d/*.xml/etc/clickhouse-server/conf.d/*.xml

引用自:https://dba.stackexchange.com/questions/294273