赞
踩
### 错误类型1
2024.04.17 14:07:36.146364 [ 687 ] {} <Error> void DB::SystemLog<DB::MetricLogElement>::flushImpl(const std::vector<LogElement> &, uint64_t) [LogElement = DB::MetricLogElement]: std::exception. Code: 1001, type: std::__1::__fs::filesystem::filesystem_error, e.what() = filesystem error: in rename: Permission denied ["/var/lib/clickhouse/store/aab/aabeb250-8346-4fe7-9324-43afb2acfdd9/tmp_insert_202404_12_12_0/"] ["/var/lib/clickhouse/store/aab/aabeb250-8346-4fe7-9324-43afb2acfdd9/202404_12_12_0/"], Stack trace (when copying this message, always include the lines below):
### 错误类型2
2024.04.17 23:45:25.431312 [ 686 ] {} <Error> void DB::SystemLog<DB::TraceLogElement>::flushImpl(const std::vector<LogElement> &, uint64_t) [LogElement = DB::TraceLogElement]: Code: 481. DB::ErrnoException: Cannot set modification time to file: /var/lib/clickhouse/store/903/903c5a1f-a517-476c-bbde-0a1820d67d99/tmp_insert_202404_5_5_0/: , errno: 1, strerror: Operation not permitted. (PATH_ACCESS_DENIED), Stack trace (when copying this message, always include the lines below):
大概都是说无法写文件或者修改文件
services:
clickhouse:
image: clickhouse/clickhouse-server:23
container_name: clickhouse
+ privileged: true
+ user: root
ports:
- 8123:8123
- 9000:9000
restart: always
volumes:
- ./log:/var/log/clickhouse-server:wr
- ./conf:/etc/clickhouse-server
- ./data:/var/lib/clickhouse:wr
privileged: true
修改用户的执行权限,添加user:root
都没能解决当前问题。
在容器内执行 df -ih
看到数据目录挂载的路径Inodes有异常,进一步跟踪Inodes问题
root@6b6ab9114480:/var/lib/clickhouse# df -ih
Filesystem Inodes IUsed IFree IUse% Mounted on
overlay 64M 179K 64M 1% /
tmpfs 982K 189 982K 1% /dev
tmpfs 982K 16 982K 1% /sys/fs/cgroup
shm 982K 1 982K 1% /dev/shm
C:\ 999 -976K 977K - /var/lib/clickhouse
/dev/sdd 64M 179K 64M 1% /etc/hosts
ulimits
参数如下重启还是没能解决
+ ulimits:
+ nproc: 65535
+ nofile:
+ soft: 65535
+ hard: 65535
也没能解决
具体compose如下:
volumes: data: services: clickhouse: image: clickhouse/clickhouse-server:23 container_name: clickhouse privileged: true ports: - 8123:8123 - 9000:9000 restart: always volumes: - ./log:/var/log/clickhouse-server:wr - ./conf:/etc/clickhouse-server - data:/var/lib/clickhouse:wr
docker的数据卷只在docker环境下管理,在本地路径中找不到,可以通过下面命令查看具体数据
docker volume ls
docker volume inspect data
在win下docker的 绑定挂载(bind mount)模式可以将宿主机上的特定目录映射到容器内的指定目录,但是不能支持有大量文件创建的目录绑定,会有inode不够导致数据无法写入的问题,即便是权限、空间都满足,但硬盘格式不匹配,导致inode信息不匹配。
如果映射的目录有大量文件的创建删除,需要使用docker自己创建的数据卷来作为数据挂载目录,用来解决inode问题。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。