अपर्याप्त अनुमति के कारण ClickHouse DB में सम्मिलित नहीं कर सकते: / var / lib / clickhouse / data /
मैंने एक डॉकटर के माध्यम से एक कंटेनर में एक 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.
मुझे INSERT INTO की अनुमति कैसे मिलेगी?
टिप्पणियाँ:
मेरे पास कोई समस्या नहीं है:
SELECT * FROM simple_people
मैं WSL पर हूँ: Ubuntu-20.04
जवाब
यह WSL + docker के कारण है।
के बजाय पूर्ण पथ का प्रयास करें
मैंने बिना डॉकटर के विंडोज सर्वर 2019 पर सीधे WSL Ubuntu 18.04 पर क्लिकहाउस स्थापित किया और उसी मुद्दे का सामना किया। मेरे मामले में मैं ClickHouse भंडारण नीति सेटअप के साथ एक तालिका में डेटा सम्मिलित करने का प्रयास कर रहा था ताकि सभी डेटा / mnt / f / clickhouse (विंडोज़ पर 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: ड्राइव को हटाकर लिनक्स और विंडोज़ के बीच अनुमतियों को समेटता है। और फिर क्लिकहाउस फ़ोल्डर को फिर से बनाएँ यदि यह पहले से मौजूद है।
sudo umount /mnt/f
sudo mount -t drvfs F: /mnt/f -o metadata
अतिरिक्त जानकारी
यदि आपके पास अपने डेटा का स्थान चुनने के लिए क्लिकहाउस पर स्टोरेज पॉलिसी सेटअप करने के बारे में कोई प्रश्न हैं। नीचे मेरी /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';