一、背景
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