ClickHouse: ACCESS_STORAGE_FOR_INSERTION_NOT_FOUND when creating new user.

Posted 东海陈光剑

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ClickHouse: ACCESS_STORAGE_FOR_INSERTION_NOT_FOUND when creating new user.相关的知识,希望对你有一定的参考价值。

问题描述

:) CREATE USER root HOST IP '127.0.0.1' IDENTIFIED WITH plaintext_password BY 'root'

CREATE USER root IDENTIFIED WITH plaintext_password BY 'root' HOST LOCAL

Query id: 6f788699-e3a5-4c43-9aaa-927917bc0f33


0 rows in set. Elapsed: 0.002 sec. 

Received exception from server (version 22.4.1):
Code: 514. DB::Exception: Received from 127.0.0.1:9009. DB::Exception: Could not insert user `root` because there is no writeable access storage in user directories. (ACCESS_STORAGE_FOR_INSERTION_NOT_FOUND)

解决方案

配置 Path to folder where users created by SQL commands are stored

<local_directory>
    <!-- Path to folder where users created by SQL commands are stored. -->
    <path>/Users/data/clickhouse/users/</path>
 </local_directory>

config.xml

<?xml version="1.0"?>
<clickhouse>
    <logger>
        <level>trace</level>
        <log>/Users/data/clickhouse/logs/clickhouse.log</log>
        <errorlog>/Users/data/clickhouse/logs/error.log</errorlog>
        <size>500M</size>
        <count>5</count>
    </logger>
    <http_port>8123</http_port>
    <tcp_port>9009</tcp_port>
    <interserver_http_port>9000</interserver_http_port>
    <interserver_http_host>127.0.0.1</interserver_http_host>  
    <listen_host>0.0.0.0</listen_host>
    <max_connections>4096</max_connections>
    <keep_alive_timeout>300</keep_alive_timeout>
    <max_concurrent_queries>1000</max_concurrent_queries>
    <uncompressed_cache_size>8589934592</uncompressed_cache_size>
    <mark_cache_size>5368709120</mark_cache_size>

    <!-- Path to data directory, with trailing slash. -->
    <path>/Users/data/clickhouse/</path>

    <!-- Path to temporary data for processing hard queries. -->
    <tmp_path>/Users/data/clickhouse/tmp/</tmp_path>
    
    <!-- Directory with user provided files that are accessible by 'file' table function. -->
    <user_files_path>/Users/data/clickhouse/user_files/</user_files_path>


    <!-- Sources to read users, roles, access rights, profiles of settings, quotas. -->
    <user_directories>
        <users_xml>
            <!-- Path to configuration file with predefined users. -->
            <path>users.xml</path>
        </users_xml>
        <local_directory>
            <!-- Path to folder where users created by SQL commands are stored. -->
            <path>/Users/data/clickhouse/users/</path>
        </local_directory>
    </user_directories>

    <default_profile>default</default_profile>
    <default_database>default</default_database>
    <builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
    <max_session_timeout>3600</max_session_timeout>
    <default_session_timeout>300</default_session_timeout>
    <max_table_size_to_drop>0</max_table_size_to_drop>
    <merge_tree>
        <parts_to_delay_insert>300</parts_to_delay_insert>
        <parts_to_throw_insert>600</parts_to_throw_insert>
        <max_delay_to_insert>2</max_delay_to_insert>
    </merge_tree>
    <max_table_size_to_drop>0</max_table_size_to_drop>
    <max_partition_size_to_drop>0</max_partition_size_to_drop>
</clickhouse>

user.xml

<?xml version="1.0"?>
<clickhouse>
    <profiles>
        <default>
            <max_memory_usage>10000000000</max_memory_usage>
            <use_uncompressed_cache>0</use_uncompressed_cache>
            <load_balancing>random</load_balancing>
        </default>
        <readonly>
            <max_memory_usage>10000000000</max_memory_usage>
            <use_uncompressed_cache>0</use_uncompressed_cache>
            <load_balancing>random</load_balancing>
            <readonly>1</readonly>
        </readonly>
    </profiles>
    <quotas>
        <!-- Name of quota. -->
        <default>
            <interval>
                <queries>0</queries>
                <errors>0</errors>
                <result_rows>0</result_rows>
                <read_rows>0</read_rows>
                <execution_time>0</execution_time>
            </interval>
        </default>
    </quotas>
    <users>
        <default>
            <!-- PASSWORD=$(base64 < /dev/urandom | head -c8); echo  "$PASSWORD"; echo -n  "$PASSWORD" | sha256sum | tr -d '-'   -->
            <!-- password 7Dv7Ib0g -->
            <password_sha256_hex>0c9858b4a1fb6c66d637e6b3a5e0977912c22a9d2f77e007ef7594226af409f5</password_sha256_hex>
            <networks>
                <ip>::/0</ip>
            </networks>
            <profile>default</profile>
            <quota>default</quota>
            <!-- User can create other users and grant rights to them. -->
            <access_management>1</access_management>
        </default>
        <ck>
            <password_sha256_hex>0c9858b4a1fb6c66d637e6b3a5e0977912c22a9d2f77e007ef7594226af409f5</password_sha256_hex>
            <networks>
                <ip>::/0</ip>
            </networks>
            <profile>readonly</profile>
            <quota>default</quota>
        </ck>
    </users>
</clickhouse>

重启 ClickHouse Server

以上是关于ClickHouse: ACCESS_STORAGE_FOR_INSERTION_NOT_FOUND when creating new user.的主要内容,如果未能解决你的问题,请参考以下文章

clickhouse-S3

clickhouse安装与启动

clickhouse常见的一些问题

大数据 OLAP ClickHouse 引擎ClickHouse 系统架构和存储引擎实现原理 : 为什么 ClickHouse 这么快? Why is ClickHouse so fast?

clickhouse-FREEZE分区操作

clickhouse 集群配置无法生效