Skip to content

Instantly share code, notes, and snippets.

@paderinandrey
Created July 24, 2022 21:49
Show Gist options
  • Save paderinandrey/bd8089d2b323832e4abdf05ea3116794 to your computer and use it in GitHub Desktop.
Save paderinandrey/bd8089d2b323832e4abdf05ea3116794 to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<clickhouse>
<clickhouse_remote_servers>
<local>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>64.225.65.90</host>
<port>9000</port>
</replica>
<replica>
<host>64.225.67.87</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>161.35.89.218</host>
<port>9000</port>
</replica>
<replica>
<host>64.227.78.186</host>
<port>9000</port>
</replica>
</shard>
</local>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>64.225.65.90</host>
<port>2181</port>
</node>
<node index="2">
<host>64.225.67.87</host>
<port>2181</port>
</node>
<node index="3">
<host>161.35.89.218</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<cluster>local</cluster>
<replica>64.225.65.90</replica>
<shard>01</shard>
</macros>
</clickhouse>
<?xml version="1.0"?>
<clickhouse>
<clickhouse_remote_servers>
<local>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>64.225.65.90</host>
<port>9000</port>
</replica>
<replica>
<host>64.225.67.87</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>161.35.89.218</host>
<port>9000</port>
</replica>
<replica>
<host>64.227.78.186</host>
<port>9000</port>
</replica>
</shard>
</local>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>64.225.65.90</host>
<port>2181</port>
</node>
<node index="2">
<host>64.225.67.87</host>
<port>2181</port>
</node>
<node index="3">
<host>161.35.89.218</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<cluster>local</cluster>
<replica>64.225.67.87</replica>
<shard>01</shard>
</macros>
</clickhouse>
<?xml version="1.0"?>
<clickhouse>
<clickhouse_remote_servers>
<local>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>64.225.65.90</host>
<port>9000</port>
</replica>
<replica>
<host>64.225.67.87</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>161.35.89.218</host>
<port>9000</port>
</replica>
<replica>
<host>64.227.78.186</host>
<port>9000</port>
</replica>
</shard>
</local>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>64.225.65.90</host>
<port>2181</port>
</node>
<node index="2">
<host>64.225.67.87</host>
<port>2181</port>
</node>
<node index="3">
<host>161.35.89.218</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<cluster>local</cluster>
<replica>161.35.89.218</replica>
<shard>02</shard>
</macros>
</clickhouse>
<?xml version="1.0"?>
<clickhouse>
<clickhouse_remote_servers>
<local>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>64.225.65.90</host>
<port>9000</port>
</replica>
<replica>
<host>64.225.67.87</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>161.35.89.218</host>
<port>9000</port>
</replica>
<replica>
<host>64.227.78.186</host>
<port>9000</port>
</replica>
</shard>
</local>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>64.225.65.90</host>
<port>2181</port>
</node>
<node index="2">
<host>64.225.67.87</host>
<port>2181</port>
</node>
<node index="3">
<host>161.35.89.218</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<cluster>local</cluster>
<replica>64.227.78.186</replica>
<shard>02</shard>
</macros>
</clickhouse>

show create table app.events_local FORMAT Vertical;

SHOW CREATE TABLE app.events_local
FORMAT Vertical

Query id: f68db6be-889d-4c83-9ec0-5e68b0ca31a9

Row 1:
──────
statement: CREATE TABLE app.events_local
(
    `id` Int64,
    `title` String,
    `description` String,
    `content` String,
    `date` Date
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{shard}/app/events_local', '{replica}')
PARTITION BY date
ORDER BY id
SETTINGS index_granularity = 8192

1 row in set. Elapsed: 0.002 sec.

show create table app.events_distributed FORMAT Vertical

SHOW CREATE TABLE app.events_distributed
FORMAT Vertical

Query id: fc860c99-43de-4e77-a504-ab6520bca8e8

Row 1:
──────
statement: CREATE TABLE app.events_distributed
(
    `id` Int64,
    `title` String,
    `description` String,
    `content` String,
    `date` Date
)
ENGINE = Distributed('{cluster}', 'app', 'events_local', rand())

1 row in set. Elapsed: 0.003 sec.

Server 1

select * from app.events_local

SELECT *
FROM app.events_local

Query id: bf890d64-5ce7-471c-8c43-0e8f7e24db01

┌─id─┬─title─────────┬─description──────────────────────────────────────────────────┬─content────────────────────────────────────────────┬───────date─┐
│  2 │ Longley       │ Longley's Regression Data                                    │ Please provide pharmacy name                       │ 2020-10-10 │
│  3 │ MASchools     │ Massachusetts Test Score Data                                │ Please provide hospital name or location           │ 2020-10-10 │
│  6 │ Blackmore     │ Exercise Histories of Eating-Disordered and Control Subjects │ I can guide you through Adverse drug reaction list │ 2020-10-10 │
│  9 │ cottonworkers │ Occupation and wage profiles of British cotton workers       │ Offering support for Adverse drug reaction         │ 2020-10-10 │
└────┴───────────────┴──────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────┴────────────┘

4 rows in set. Elapsed: 0.005 sec.

select * from app.events_distributed


SELECT *
FROM app.events_distributed

Query id: 91e63b6e-adf1-4d26-b407-393e6e6442c4

┌─id─┬─title─────────┬─description──────────────────────────────────────────────────┬─content────────────────────────────────────────────┬───────date─┐
│  2 │ Longley       │ Longley's Regression Data                                    │ Please provide pharmacy name                       │ 2020-10-10 │
│  3 │ MASchools     │ Massachusetts Test Score Data                                │ Please provide hospital name or location           │ 2020-10-10 │
│  6 │ Blackmore     │ Exercise Histories of Eating-Disordered and Control Subjects │ I can guide you through Adverse drug reaction list │ 2020-10-10 │
│  9 │ cottonworkers │ Occupation and wage profiles of British cotton workers       │ Offering support for Adverse drug reaction         │ 2020-10-10 │
└────┴───────────────┴──────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────┴────────────┘
┌─id─┬─title─────────┬─description───────────────────────────────────────────────────────────────────┬─content────────────────────────────────────┬───────date─┐
│  1 │ CigarettesB   │ Cigarette Consumption Data                                                    │ Loading Blood pressure result for Patient  │ 2020-10-10 │
│  4 │ ShipAccidents │ Ship Accidents                                                                │ Please provide Patient ID                  │ 2020-10-10 │
│  5 │ bigcity       │ Population of U.S. Cities                                                     │ Navigating to Blood Pressure module        │ 2020-10-10 │
│  7 │ States        │ Education and Related Statistics for the U.S. States                          │ Blood pressure tracking                    │ 2020-10-10 │
│  8 │ close_college │ Data from Card (1995) to estimate the effect of college education on earnings │ Hospitals and Pharmacies                   │ 2020-10-10 │
│ 10 │ rainforest    │ Rainforest Data                                                               │ Offering support for Adverse drug reaction │ 2020-10-10 │
└────┴───────────────┴───────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┘

10 rows in set. Elapsed: 0.016 sec.

Server 2

select * from app.events_local

SELECT *
FROM app.events_local

Query id: b419e511-5797-4068-8e90-f7c84cf94884

┌─id─┬─title─────────┬─description──────────────────────────────────────────────────┬─content────────────────────────────────────────────┬───────date─┐
│  2 │ Longley       │ Longley's Regression Data                                    │ Please provide pharmacy name                       │ 2020-10-10 │
│  3 │ MASchools     │ Massachusetts Test Score Data                                │ Please provide hospital name or location           │ 2020-10-10 │
│  6 │ Blackmore     │ Exercise Histories of Eating-Disordered and Control Subjects │ I can guide you through Adverse drug reaction list │ 2020-10-10 │
│  9 │ cottonworkers │ Occupation and wage profiles of British cotton workers       │ Offering support for Adverse drug reaction         │ 2020-10-10 │
└────┴───────────────┴──────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────┴────────────┘

4 rows in set. Elapsed: 0.003 sec.

select * from app.events_distributed

SELECT *
FROM app.events_distributed

Query id: ecad9f28-62d4-4d85-9995-102674c52e3d

┌─id─┬─title─────────┬─description──────────────────────────────────────────────────┬─content────────────────────────────────────────────┬───────date─┐
│  2 │ Longley       │ Longley's Regression Data                                    │ Please provide pharmacy name                       │ 2020-10-10 │
│  3 │ MASchools     │ Massachusetts Test Score Data                                │ Please provide hospital name or location           │ 2020-10-10 │
│  6 │ Blackmore     │ Exercise Histories of Eating-Disordered and Control Subjects │ I can guide you through Adverse drug reaction list │ 2020-10-10 │
│  9 │ cottonworkers │ Occupation and wage profiles of British cotton workers       │ Offering support for Adverse drug reaction         │ 2020-10-10 │
└────┴───────────────┴──────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────┴────────────┘
┌─id─┬─title─────────┬─description───────────────────────────────────────────────────────────────────┬─content────────────────────────────────────┬───────date─┐
│  1 │ CigarettesB   │ Cigarette Consumption Data                                                    │ Loading Blood pressure result for Patient  │ 2020-10-10 │
│  4 │ ShipAccidents │ Ship Accidents                                                                │ Please provide Patient ID                  │ 2020-10-10 │
│  5 │ bigcity       │ Population of U.S. Cities                                                     │ Navigating to Blood Pressure module        │ 2020-10-10 │
│  7 │ States        │ Education and Related Statistics for the U.S. States                          │ Blood pressure tracking                    │ 2020-10-10 │
│  8 │ close_college │ Data from Card (1995) to estimate the effect of college education on earnings │ Hospitals and Pharmacies                   │ 2020-10-10 │
│ 10 │ rainforest    │ Rainforest Data                                                               │ Offering support for Adverse drug reaction │ 2020-10-10 │
└────┴───────────────┴───────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┘

10 rows in set. Elapsed: 0.014 sec.

Server 3

select * from app.events_local

SELECT *
FROM app.events_local

Query id: df9c94b7-77a4-4aef-95b7-4b2c07a7df94

┌─id─┬─title─────────┬─description───────────────────────────────────────────────────────────────────┬─content────────────────────────────────────┬───────date─┐
│  1 │ CigarettesB   │ Cigarette Consumption Data                                                    │ Loading Blood pressure result for Patient  │ 2020-10-10 │
│  4 │ ShipAccidents │ Ship Accidents                                                                │ Please provide Patient ID                  │ 2020-10-10 │
│  5 │ bigcity       │ Population of U.S. Cities                                                     │ Navigating to Blood Pressure module        │ 2020-10-10 │
│  7 │ States        │ Education and Related Statistics for the U.S. States                          │ Blood pressure tracking                    │ 2020-10-10 │
│  8 │ close_college │ Data from Card (1995) to estimate the effect of college education on earnings │ Hospitals and Pharmacies                   │ 2020-10-10 │
│ 10 │ rainforest    │ Rainforest Data                                                               │ Offering support for Adverse drug reaction │ 2020-10-10 │
└────┴───────────────┴───────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┘

6 rows in set. Elapsed: 0.005 sec.

select * from app.events_distributed

SELECT *
FROM app.events_distributed

Query id: 16c0108b-f9c2-47e9-a9e8-11ef68cb31df

┌─id─┬─title─────────┬─description───────────────────────────────────────────────────────────────────┬─content────────────────────────────────────┬───────date─┐
│  1 │ CigarettesB   │ Cigarette Consumption Data                                                    │ Loading Blood pressure result for Patient  │ 2020-10-10 │
│  4 │ ShipAccidents │ Ship Accidents                                                                │ Please provide Patient ID                  │ 2020-10-10 │
│  5 │ bigcity       │ Population of U.S. Cities                                                     │ Navigating to Blood Pressure module        │ 2020-10-10 │
│  7 │ States        │ Education and Related Statistics for the U.S. States                          │ Blood pressure tracking                    │ 2020-10-10 │
│  8 │ close_college │ Data from Card (1995) to estimate the effect of college education on earnings │ Hospitals and Pharmacies                   │ 2020-10-10 │
│ 10 │ rainforest    │ Rainforest Data                                                               │ Offering support for Adverse drug reaction │ 2020-10-10 │
└────┴───────────────┴───────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┘
┌─id─┬─title─────────┬─description──────────────────────────────────────────────────┬─content────────────────────────────────────────────┬───────date─┐
│  2 │ Longley       │ Longley's Regression Data                                    │ Please provide pharmacy name                       │ 2020-10-10 │
│  3 │ MASchools     │ Massachusetts Test Score Data                                │ Please provide hospital name or location           │ 2020-10-10 │
│  6 │ Blackmore     │ Exercise Histories of Eating-Disordered and Control Subjects │ I can guide you through Adverse drug reaction list │ 2020-10-10 │
│  9 │ cottonworkers │ Occupation and wage profiles of British cotton workers       │ Offering support for Adverse drug reaction         │ 2020-10-10 │
└────┴───────────────┴──────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────┴────────────┘

10 rows in set. Elapsed: 0.022 sec.

Server 4

select * from app.events_local

SELECT *
FROM app.events_local

Query id: 4bf24eb6-8976-448c-8326-b40da99bc41a

┌─id─┬─title─────────┬─description───────────────────────────────────────────────────────────────────┬─content────────────────────────────────────┬───────date─┐
│  1 │ CigarettesB   │ Cigarette Consumption Data                                                    │ Loading Blood pressure result for Patient  │ 2020-10-10 │
│  4 │ ShipAccidents │ Ship Accidents                                                                │ Please provide Patient ID                  │ 2020-10-10 │
│  5 │ bigcity       │ Population of U.S. Cities                                                     │ Navigating to Blood Pressure module        │ 2020-10-10 │
│  7 │ States        │ Education and Related Statistics for the U.S. States                          │ Blood pressure tracking                    │ 2020-10-10 │
│  8 │ close_college │ Data from Card (1995) to estimate the effect of college education on earnings │ Hospitals and Pharmacies                   │ 2020-10-10 │
│ 10 │ rainforest    │ Rainforest Data                                                               │ Offering support for Adverse drug reaction │ 2020-10-10 │
└────┴───────────────┴───────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┘

6 rows in set. Elapsed: 0.005 sec.

select * from app.events_distributed


SELECT *
FROM app.events_distributed

Query id: aae4c043-c3fa-4f98-bffc-401043950734

┌─id─┬─title─────────┬─description───────────────────────────────────────────────────────────────────┬─content────────────────────────────────────┬───────date─┐
│  1 │ CigarettesB   │ Cigarette Consumption Data                                                    │ Loading Blood pressure result for Patient  │ 2020-10-10 │
│  4 │ ShipAccidents │ Ship Accidents                                                                │ Please provide Patient ID                  │ 2020-10-10 │
│  5 │ bigcity       │ Population of U.S. Cities                                                     │ Navigating to Blood Pressure module        │ 2020-10-10 │
│  7 │ States        │ Education and Related Statistics for the U.S. States                          │ Blood pressure tracking                    │ 2020-10-10 │
│  8 │ close_college │ Data from Card (1995) to estimate the effect of college education on earnings │ Hospitals and Pharmacies                   │ 2020-10-10 │
│ 10 │ rainforest    │ Rainforest Data                                                               │ Offering support for Adverse drug reaction │ 2020-10-10 │
└────┴───────────────┴───────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┘
┌─id─┬─title─────────┬─description──────────────────────────────────────────────────┬─content────────────────────────────────────────────┬───────date─┐
│  2 │ Longley       │ Longley's Regression Data                                    │ Please provide pharmacy name                       │ 2020-10-10 │
│  3 │ MASchools     │ Massachusetts Test Score Data                                │ Please provide hospital name or location           │ 2020-10-10 │
│  6 │ Blackmore     │ Exercise Histories of Eating-Disordered and Control Subjects │ I can guide you through Adverse drug reaction list │ 2020-10-10 │
│  9 │ cottonworkers │ Occupation and wage profiles of British cotton workers       │ Offering support for Adverse drug reaction         │ 2020-10-10 │
└────┴───────────────┴──────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────┴────────────┘

10 rows in set. Elapsed: 0.014 sec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment