권한이 부족하여 ClickHouse DB에 삽입 할 수 없음 : / var / lib / clickhouse / data /

Dec 15 2020

docker-compose를 통해 컨테이너에 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

답변

1 DennyCrane Dec 16 2020 at 00:27

WSL + 도커 때문입니다.

./data 대신 전체 경로를 시도하십시오.

1 sh0ck_wave Dec 21 2020 at 04:42

도커없이 Windows 서버 2019의 WSL Ubuntu 18.04에 직접 클릭 하우스를 설치했으며 동일한 문제에 직면했습니다. 제 경우에는 모든 데이터가 / mnt / f / clickhouse (Windows의 F : \ clickhouse)에 저장되도록 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

이 문제에 대한 수정 사항은 기능이 활성화 된 F : 드라이브를 다시 마운트하여 Linux와 Windows간에 권한을 동기화하는 WSL에서 메타 데이터 기능을 활성화하는 것이 었습니다. 그런 다음 클릭 하우스 폴더가 이미있는 경우 다시 만듭니다.

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';