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_shard_localhost>
            <shard>
                <replica>
                    <host>localhosthost>
                    <port>9000port>
                replica>
            shard>
        test_shard_localhost>
        <test_cluster_two_shards_localhost>
             <shard>
                 <replica>
                     <host>localhosthost>
                     <port>9000port>
                 replica>
             shard>
             <shard>
                 <replica>
                     <host>localhosthost>
                     <port>9000port>
                 replica>
             shard>
        test_cluster_two_shards_localhost>
		<test_cluster_two_shards>
            <shard>
                <replica>
                    <host>127.0.0.1host>
                    <port>9000port>
                replica>
            shard>
            <shard>
                <replica>
                    <host>127.0.0.2host>
                    <port>9000port>
                replica>
            shard>
        test_cluster_two_shards>
        <test_shard_localhost_secure>
            <shard>
                <replica>
                    <host>localhosthost>
                    <port>9440port>
                    <secure>1secure>
                replica>
            shard>
        test_shard_localhost_secure>
        <test_unavailable_shard>
            <shard>
                <replica>
                    <host>localhosthost>
                    <port>9000port>
                replica>
            shard>
            <shard>
                <replica>
                    <host>localhosthost>
                    <port>1port>
                replica>
            shard>
        test_unavailable_shard>
remote_servers>

修改标签

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

你可能感兴趣的:(clickhouse)