如何在clickhouse中设置复制副本和碎片?

qvk1mo1f  于 2021-07-15  发布在  ClickHouse
关注(0)|答案(1)|浏览(464)

你知道有没有什么网站文章可以指导我如何在clickhouse中设置副本或碎片?我对Zookeeper也不了解,不知道如何开始;我在网上读到的大部分文章都是关于它是如何工作的,但我找不到如何设置它。
所有这些文章都显示了一些设置;然而,我不知道如何把他们放在一起。
例如,我不知道把Zookeeper的配置放在哪里。。。
我读过这些文章

https://clickhouse.yandex/tutorial.html
https://blog.uiza.io/replicated-vs-distributed-on-clickhouse-part-1/
https://blog.uiza.io/replicated-and-distributed-on-clickhouse-part-2/
https://www.altinity.com/blog/2018/5/10/circular-replication-cluster-topology-in-clickhouse
Set ZooKeeper locations in configuration file
<zookeeper-servers>
    <node>
        <host>zoo01.yandex.ru</host>
        <port>2181</port>
    </node>
    <node>
        <host>zoo02.yandex.ru</host>
        <port>2181</port>
    </node>
    <node>
        <host>zoo03.yandex.ru</host>
        <port>2181</port>
    </node>
</zookeeper-servers>
wqsoz72f

wqsoz72f1#

zookeeper它是一个独立的守护程序,您需要安装并运行它(一个zookeeper守护程序示例就足够了),然后您需要添加

<zookeeper-servers>
    <node>
        <host>zoo01.yourdomain.com</host>
        <port>2181</port>
    </node>
</zookeeper-servers>

在每个clickhouse服务器上配置
并将远程服务器配置添加到每个clickhouse服务器,即。

<remote_servers>
        <your_cluster_name>
            <shard>
                <weight>1</weight>
                <internal_replication>true</internal_replication>
                <replica>
                    <host>clickhouse-ru-1.local</host>
                    <port>9000</port>
                </replica>
                <replica>
                    <host>clickhouse-ru-2.local</host>
                    <port>9000</port>
                </replica>
            </shard>
            <shard>
                <weight>1</weight>
                <internal_replication>false</internal_replication>
                <replica>
                    <host>clickhouse-eu-1.local</host>
                    <port>9000</port>
                </replica>
                <replica>
                    <host>clickhouse-eu-2.local</host>
                    <port>9000</port>
                </replica>
            </shard>
            <shard>
                <weight>1</weight>
                <internal_replication>false</internal_replication>
                <replica>
                    <host>clickhouse-us-1.local</host>
                    <port>9000</port>
                </replica>
                <replica>
                    <host>clickhouse-us-2.local</host>
                    <port>9000</port>
                </replica>
            </shard>
        </your_cluster_name>
    </remote_servers>

之后请阅读分布式表引擎https://clickhouse.yandex/docs/en/operations/table_engines/distributed/

相关问题