其他分享
首页 > 其他分享> > clickhouse踩过的坑-----建表建库on cluster命令使用超时(code:159)distributed_ddl_task_timeout (=180) seconds

clickhouse踩过的坑-----建表建库on cluster命令使用超时(code:159)distributed_ddl_task_timeout (=180) seconds

作者:互联网

建库建表语句

create database test on cluster clickhouse_cluster;

报错信息

↘ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 20.1.4):
Code: 159. DB::Exception: Received from localhost:9000. DB::Exception: Watching task /clickhouse/task_queue/ddl/query-0000000011 is executing longer than distributed_ddl_task_timeout (=180) seconds. There are 2 unfinished hosts (0 of them are currently active), they are going to execute the query in background.

问题解决

在/etc/clickhouse-server/config.xml中修改remote_servers标签

原本标签

<remote_servers incl="clickhouse_remote_servers" >
        <!-- Test only shard config for testing distributed storage -->
        <test_shard_localhost>
            <shard>
                <replica>
                    <host>localhost</host>
                    <port>9000</port>
                </replica>
            </shard>
        </test_shard_localhost>
        <test_cluster_two_shards_localhost>
             <shard>
                 <replica>
                     <host>localhost</host>
                     <port>9000</port>
                 </replica>
             </shard>
             <shard>
                 <replica>
                     <host>localhost</host>
                     <port>9000</port>
                 </replica>
             </shard>
        </test_cluster_two_shards_localhost>
		<test_cluster_two_shards>
            <shard>
                <replica>
                    <host>127.0.0.1</host>
                    <port>9000</port>
                </replica>
            </shard>
            <shard>
                <replica>
                    <host>127.0.0.2</host>
                    <port>9000</port>
                </replica>
            </shard>
        </test_cluster_two_shards>
        <test_shard_localhost_secure>
            <shard>
                <replica>
                    <host>localhost</host>
                    <port>9440</port>
                    <secure>1</secure>
                </replica>
            </shard>
        </test_shard_localhost_secure>
        <test_unavailable_shard>
            <shard>
                <replica>
                    <host>localhost</host>
                    <port>9000</port>
                </replica>
            </shard>
            <shard>
                <replica>
                    <host>localhost</host>
                    <port>1</port>
                </replica>
            </shard>
        </test_unavailable_shard>
</remote_servers>

修改标签

<remote_servers>
        <clickhouse_cluster>
            <shard>
                <replica>
                    <host>主节点ip</host>
                    <port>9000</port>
                </replica>
                <replica>
                    <host>备份节点ip</host>
                    <port>9000</port>
                </replica>
            </shard>
        </clickhouse_cluster>
</remote_servers>

标签:code,159,0.00,ddl,cluster,task,localhost,9000,clickhouse
来源: https://blog.csdn.net/lyq7269/article/details/115284837