Hello and thank you for the answer!
I've followed all recommendations you gave and got the same result...
Also I have tried to setup only one shard with two replicas and it surely gave correct result with one row from select request... but i need a real distributed schema both on select and insert requests.
Here is all the steps I make on my test nodes (red mark means different value on different servers)
Minor changes in root clickhouse config /etc/clickhouse-server/config.xml on both nodes:
<default_database>slicer00</default_database>
<listen_host>::</listen_host>
<include_from>/etc/clickhouse-server/my.xml</include_from>
Same /etc/clickhouse-server/my.xml on both nodes:
<yandex>
<clickhouse_remote_servers>
<slicer>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>10.246.1.115</host>
<port>9000</port>
</replica>
<replica>
<host>10.246.1.93</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>10.246.1.115</host>
<port>9000</port>
</replica>
<replica>
<host>10.246.1.93</host>
<port>9000</port>
</replica>
</shard>
</slicer>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>10.246.1.115</host>
<port>2181</port>
</node>
<node index="2">
<host>10.246.1.93</host>
<port>2181</port>
</node>
</zookeeper-servers>
</yandex>
I start with default zookeeper config and empty data directories on both servers:
service clickhouse-server stop
service zookeeper-server stop
rm -rf /var/lib/clickhouse/data/slicer0* /var/lib/clickhouse/metadata/slicer0*
rm -rf /var/lib/zookeeper/*
service zookeeper-server init
service zookeeper-server start
service clickhouse-server start
Init tables on both servers:
cat <<EOF | clickhouse-client --multiquery;
CREATE DATABASE slicer00;
CREATE DATABASE slicer01;
CREATE TABLE slicer00.tesd (
siteId UInt32,
date Date,
docUuid FixedString(37),
metricV UInt32,
metricS0 UInt32,
metricS1 UInt32,
metricS2 UInt32,
metricTS0 UInt32,
metricTS1 UInt32,
metricTS2 UInt32,
metricX UInt32
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/slicer00/tesd', 'server0', date, (siteId, date, docUuid), 8192);
CREATE TABLE slicer01.tesd (
siteId UInt32,
date Date,
docUuid FixedString(37),
metricV UInt32,
metricS0 UInt32,
metricS1 UInt32,
metricS2 UInt32,
metricTS0 UInt32,
metricTS1 UInt32,
metricTS2 UInt32,
metricX UInt32
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/slicer01/tesd', 'server0', date, (siteId, date, docUuid), 8192);
CREATE TABLE tesd_all AS tesd ENGINE = Distributed(slicer, '', tesd, cityHash64(docUuid));
EOF
Insert only one row in tesd_all:
cat <<EOF | clickhouse-client --query="INSERT INTO tesd_all FORMAT TabSeparated"
1 1970-01-02 F7336ADC-8E70-11E7-A061-A2AE6567C489 1 1 1 1 1 1 1 1
EOF
And finally select from tesd_all:
# clickhouse-client --query="select * from tesd_all"
1 1970-01-02 F7336ADC-8E70-11E7-A061-A2AE6567C489\0 1 1 1 1 1 1 1 1
1 1970-01-02 F7336ADC-8E70-11E7-A061-A2AE6567C489\0 1 1 1 1 1 1 1 1
Any ideas?
Hello!
Hello!