我通过docker-组合在容器中创建了一个ClickHouse DB的实例:
version: '3'
services:
ch:
image: yandex/clickhouse-server
restart: on-failure
volumes:
- '/mnt/c/DevTools/source/storm/clickhouse_setup/data/ch:/var/lib/clickhouse/'
- './ch_configs:/etc/clickhouse-server/'
ports:
- 9000:9000
- 8123:8123
ulimits:
nofile: 262144
client:
image: yandex/clickhouse-client
volumes:
- './client-config.xml:/etc/clickhouse-client/config.xml'我可以访问它并找到我创建的数据库,但是当我运行
INSERT INTO simple_people (id, first_name, last_name) VALUES(1,'david','lo')我得到了这样的回应:
Query id: 46ef1af8-5728-425e-87f5-511f7e0e79d1
Received exception from server (version 20.12.3):
Code: 1000. DB::Exception: Received from ch:9000. DB::Exception: Access to file denied: insufficient permissions: /var/lib/clickhouse/data/registry/simple_people/tmp_insert_1_2_2_0.
1 rows in set. Elapsed: 0.068 sec.如何获得插入的权限?
备注:
我没有问题:
SELECT * FROM simple_people我在WSL上: Ubuntu-20.04
发布于 2020-12-15 17:27:51
这是因为WSL +码头。
尝试完全路径,而不是./data
发布于 2020-12-20 21:42:50
我在WSL Ubuntu18.04上直接安装了clickhouse,在没有停靠器的情况下,我在2019年Windows服务器上安装了clickhouse,并面临着同样的问题。在我的示例中,我试图将数据插入一个具有ClickHouse存储策略设置的表中,以便将所有数据存储在/mnt/f/clickhouse (windows上的F:\clickhouse)中。我得到的错误是:
DB::Exception: Access to file denied: insufficient permissions: /mnt/f/clickhouse/store/1e6/1e69cad8-25a1-4ec5-ab5b-fb32d73b7c8c/tmp_insert_all_2_2_0解决这个问题的方法是在WSL上启用元数据特性,通过重新安装启用了功能的F:驱动器来同步linux和windows之间的权限。然后,如果clickhouse文件夹已经存在,则重新创建它。
sudo umount /mnt/f
sudo mount -t drvfs F: /mnt/f -o metadata额外信息
如果您对如何在clickhouse上设置存储策略以选择数据的位置有任何疑问。下面是my /etc/clickhouse-server/config.d/storage.xml的内容
<yandex>
<storage_configuration>
<disks>
<!--
default disk is special, it always
exists even if not explicitly
configured here, but you can't change
it's path here (you should use <path>
on top level config instead)
-->
<default>
<!--
You can reserve some amount of free space
on any disk (including default) by adding
keep_free_space_bytes tag
-->
<keep_free_space_bytes>1024</keep_free_space_bytes>
</default>
<mnt_f>
<!--
disk path must end with a slash,
folder should be writable for clickhouse user
-->
<path>/mnt/f/clickhouse/</path>
</mnt_f>
</disks>
<policies>
<mnt_f_only> <!-- name for new storage policy -->
<volumes>
<mnt_f_volume> <!-- name of volume -->
<!--
we have only one disk in that volume
and we reference here the name of disk
as configured above in <disks> section
-->
<disk>mnt_f</disk>
</mnt_f_volume>
</volumes>
</mnt_f_only>
</policies>
</storage_configuration>
</yandex>在创建表时选择存储策略:
CREATE TABLE test(
EventId String,
EventName Nullable(String),
) ENGINE = MergeTree()
ORDER BY EventId
SETTINGS storage_policy = 'mnt_f_only';https://stackoverflow.com/questions/65307600
复制相似问题