<?xml version="1.0"?>
<clickhouse>
    <!-- How many simualteneous workers are posssible -->
    <max_workers>3</max_workers>

    <!-- Common setting for pull and push operations -->
    <settings>
        <connect_timeout>1</connect_timeout>
    </settings>

    <!-- Setting used to fetch data -->
    <settings_pull>
        <max_rows_in_distinct>0</max_rows_in_distinct>
    </settings_pull>

    <!-- Setting used to insert data -->
    <settings_push>
    </settings_push>

    <!-- Tasks -->
    <tables>
        <hits>
            <cluster_pull>source_trivial_cluster</cluster_pull>
            <database_pull>default</database_pull>
            <table_pull>trivial_without_arguments</table_pull>

            <cluster_push>destination_trivial_cluster</cluster_push>
            <database_push>default</database_push>
            <table_push>trivial_without_arguments</table_push>

            <!-- Engine of destination tables -->
            <engine>ENGINE=ReplicatedMergeTree() PARTITION BY d % 5 ORDER BY (d, sipHash64(d)) SAMPLE BY sipHash64(d) SETTINGS index_granularity = 16</engine>

            <!-- Which sarding key to use while copying -->
            <sharding_key>d + 1</sharding_key>

            <!-- Optional expression that filter copying data -->
            <where_condition>d - d = 0</where_condition>
        </hits>
    </tables>

    <!-- Configuration of clusters -->
    <remote_servers>
        <source_trivial_cluster>
            <shard>
                <replica>
                    <host>first_trivial</host>
                    <port>9000</port>
                </replica>
            </shard>
        </source_trivial_cluster>


        <destination_trivial_cluster>
            <shard>
                <replica>
                    <host>second_trivial</host>
                    <port>9000</port>
                </replica>
            </shard>
        </destination_trivial_cluster>
    </remote_servers>

</clickhouse>