docker swarm部署clickhouse挂载/var/lib/clickhouse相关问题

一、背景
1、操作系统:centos Linux release 7.9.2009 (AltArch)
2、Clickhouse版本:22.4.3-arm
3、docker版本:20.10.0
4、docker-compose版本:docker-compose-linux-aarch64

二、部署服务时报错日志

clickhouse.1.xxxxxx    | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse.1.xxxxxx    | std::exception. Code: 1001, type: std::__1::__fs::filesystem::filesystem_error, e.what() = filesystem error: in create_directories: Permission denied ["/var/lib/clickhouse/preprocessed_configs"], Stack trace (when copying this message, always include the lines below):
clickhouse.1.xxxxxx    | 
clickhouse.1.xxxxxx    | 0. std::runtime_error::runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x16786830 in ?
clickhouse.1.xxxxxx    | 1. std::__1::system_error::system_error(std::__1::error_code, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1679673c in ?
clickhouse.1.xxxxxx    | 2. ? @ 0x11e47d54 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 3. ? @ 0x16736bcc in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 4. ? @ 0x1673ae88 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 5. std::__1::__fs::filesystem::__create_directories(std::__1::__fs::filesystem::path const&, std::__1::error_code*) @ 0x1673b6f0 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 6. DB::ConfigProcessor::savePreprocessedConfig(DB::ConfigProcessor::LoadedConfig const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) @ 0x13bfb740 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 7. BaseDaemon::initialize(Poco::Util::Application&) @ 0x11e65698 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 8. DB::Server::initialize(Poco::Util::Application&) @ 0x98056c4 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 9. Poco::Util::Application::run() @ 0x143d608c in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 10. DB::Server::run() @ 0x98054a4 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 11. mainEntryClickHouseServer(int, char**) @ 0x9802fec in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 12. main @ 0x97894b0 in /usr/bin/clickhouse
clickhouse.1.xxxxxx    | 13. __libc_start_main @ 0x20d50 in /lib/libc.so.6
clickhouse.1.xxxxxx    | 
clickhouse.1.xxxxxx    | Cannot print extra info for Poco::Exception (version 22.4.3.3 (official build))
clickhouse.1.xxxxxx    | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse.1.xxxxxx    | std::exception. Code: 1001, type: std::__1::__fs::filesystem::filesystem_error, e.what() = filesystem error: in create_directories: Permission denied ["/var/lib/clickhouse/preprocessed_configs"], Stack trace (when copying this message, always include the lines below):
clickhouse.1.xxxxxx    | 

三、原因
/var/lib/clickhouse目录下面存储着数据文件,挂载此目录到服务器本地路径,服务器本地路径权限不足

四、解决办法
修改主机目录的权限,给 Docker 守护进程的用户(如 docker 或 root)权限来访问和写入该目录。例如,使用 chown 和 chmod 命令:

sudo chown -R docker:docker /path/to/your/host/directory  
sudo chmod -R 775 /path/to/your/host/directory

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值