diff --git a/analytics-datastore-clickhouse/cluster_configs/docker_related_config.xml b/analytics-datastore-clickhouse/cluster_configs/docker_related_config.xml deleted file mode 100644 index 302483e3..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/docker_related_config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - :: - 0.0.0.0 - 1 - - - - diff --git a/analytics-datastore-clickhouse/cluster_configs/macros_01.xml b/analytics-datastore-clickhouse/cluster_configs/macros_01.xml deleted file mode 100644 index 6b8bfcd4..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/macros_01.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - /clickhouse/task_queue/ddl - - - cluster_3R - 1 - r1 - - diff --git a/analytics-datastore-clickhouse/cluster_configs/macros_02.xml b/analytics-datastore-clickhouse/cluster_configs/macros_02.xml deleted file mode 100644 index ed814492..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/macros_02.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - /clickhouse/task_queue/ddl - - - cluster_3R - 1 - r2 - - diff --git a/analytics-datastore-clickhouse/cluster_configs/macros_03.xml b/analytics-datastore-clickhouse/cluster_configs/macros_03.xml deleted file mode 100644 index 6883f6e8..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/macros_03.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - /clickhouse/task_queue/ddl - - - cluster_3R - 1 - r3 - - diff --git a/analytics-datastore-clickhouse/cluster_configs/macros_04.xml b/analytics-datastore-clickhouse/cluster_configs/macros_04.xml deleted file mode 100644 index 56b44e95..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/macros_04.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - /clickhouse/task_queue/ddl - - - cluster_3R - 1 - r4 - - diff --git a/analytics-datastore-clickhouse/cluster_configs/remote_servers.xml b/analytics-datastore-clickhouse/cluster_configs/remote_servers.xml deleted file mode 100644 index a400adc7..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/remote_servers.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - true - - analytics-datastore-clickhouse-01 - 9000 - - - analytics-datastore-clickhouse-02 - 9000 - - - analytics-datastore-clickhouse-03 - 9000 - - - - - diff --git a/analytics-datastore-clickhouse/cluster_configs/use_keeper.xml b/analytics-datastore-clickhouse/cluster_configs/use_keeper.xml deleted file mode 100644 index 4ce78405..00000000 --- a/analytics-datastore-clickhouse/cluster_configs/use_keeper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - analytics-datastore-clickhouse-01 - 9181 - - - analytics-datastore-clickhouse-02 - 9181 - - - analytics-datastore-clickhouse-03 - 9181 - - - analytics-datastore-clickhouse-04 - 9181 - - - diff --git a/analytics-datastore-clickhouse/configs/clickhouse-01/etc/clickhouse-server/config.d/config.xml b/analytics-datastore-clickhouse/configs/clickhouse-01/etc/clickhouse-server/config.d/config.xml new file mode 100644 index 00000000..c25020dd --- /dev/null +++ b/analytics-datastore-clickhouse/configs/clickhouse-01/etc/clickhouse-server/config.d/config.xml @@ -0,0 +1,62 @@ + + + debug + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 3 + + cluster_1S_3R node 1 + 0.0.0.0 + 8123 + 9000 + + + users.xml + + + /var/lib/clickhouse/access/ + + + + /clickhouse/task_queue/ddl + + + + + true + + clickhouse-01 + 9000 + + + clickhouse-02 + 9000 + + + clickhouse-03 + 9000 + + + + + + + clickhouse-keeper-01 + 9181 + + + clickhouse-keeper-02 + 9181 + + + clickhouse-keeper-03 + 9181 + + + + 01 + 01 + cluster_1S_3R + + diff --git a/analytics-datastore-clickhouse/configs/clickhouse-01/etc/clickhouse-server/users.d/users.xml b/analytics-datastore-clickhouse/configs/clickhouse-01/etc/clickhouse-server/users.d/users.xml new file mode 100644 index 00000000..0f32c646 --- /dev/null +++ b/analytics-datastore-clickhouse/configs/clickhouse-01/etc/clickhouse-server/users.d/users.xml @@ -0,0 +1,37 @@ + + + + + 10000000000 + 0 + in_order + 1 + + + + + 1 + default + + ::/0 + + default + 1 + 1 + 1 + 1 + + + + + + 3600 + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/analytics-datastore-clickhouse/configs/clickhouse-02/etc/clickhouse-server/config.d/config.xml b/analytics-datastore-clickhouse/configs/clickhouse-02/etc/clickhouse-server/config.d/config.xml new file mode 100644 index 00000000..f581699b --- /dev/null +++ b/analytics-datastore-clickhouse/configs/clickhouse-02/etc/clickhouse-server/config.d/config.xml @@ -0,0 +1,62 @@ + + + debug + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 3 + + cluster_1S_3R node 2 + 0.0.0.0 + 8123 + 9000 + + + users.xml + + + /var/lib/clickhouse/access/ + + + + /clickhouse/task_queue/ddl + + + + + true + + clickhouse-01 + 9000 + + + clickhouse-02 + 9000 + + + clickhouse-03 + 9000 + + + + + + + clickhouse-keeper-01 + 9181 + + + clickhouse-keeper-02 + 9181 + + + clickhouse-keeper-03 + 9181 + + + + 01 + 02 + cluster_1S_3R + + diff --git a/analytics-datastore-clickhouse/configs/clickhouse-02/etc/clickhouse-server/users.d/users.xml b/analytics-datastore-clickhouse/configs/clickhouse-02/etc/clickhouse-server/users.d/users.xml new file mode 100644 index 00000000..0f32c646 --- /dev/null +++ b/analytics-datastore-clickhouse/configs/clickhouse-02/etc/clickhouse-server/users.d/users.xml @@ -0,0 +1,37 @@ + + + + + 10000000000 + 0 + in_order + 1 + + + + + 1 + default + + ::/0 + + default + 1 + 1 + 1 + 1 + + + + + + 3600 + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/analytics-datastore-clickhouse/configs/clickhouse-03/etc/clickhouse-server/config.d/config.xml b/analytics-datastore-clickhouse/configs/clickhouse-03/etc/clickhouse-server/config.d/config.xml new file mode 100644 index 00000000..11423117 --- /dev/null +++ b/analytics-datastore-clickhouse/configs/clickhouse-03/etc/clickhouse-server/config.d/config.xml @@ -0,0 +1,62 @@ + + + debug + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 3 + + cluster_1S_3R node 3 + 0.0.0.0 + 8123 + 9000 + + + users.xml + + + /var/lib/clickhouse/access/ + + + + /clickhouse/task_queue/ddl + + + + + true + + clickhouse-01 + 9000 + + + clickhouse-02 + 9000 + + + clickhouse-03 + 9000 + + + + + + + clickhouse-keeper-01 + 9181 + + + clickhouse-keeper-02 + 9181 + + + clickhouse-keeper-03 + 9181 + + + + 01 + 03 + cluster_1S_3R + + diff --git a/analytics-datastore-clickhouse/configs/clickhouse-03/etc/clickhouse-server/users.d/users.xml b/analytics-datastore-clickhouse/configs/clickhouse-03/etc/clickhouse-server/users.d/users.xml new file mode 100644 index 00000000..0f32c646 --- /dev/null +++ b/analytics-datastore-clickhouse/configs/clickhouse-03/etc/clickhouse-server/users.d/users.xml @@ -0,0 +1,37 @@ + + + + + 10000000000 + 0 + in_order + 1 + + + + + 1 + default + + ::/0 + + default + 1 + 1 + 1 + 1 + + + + + + 3600 + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/analytics-datastore-clickhouse/cluster_configs/enable_keeper_01.xml b/analytics-datastore-clickhouse/configs/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml similarity index 60% rename from analytics-datastore-clickhouse/cluster_configs/enable_keeper_01.xml rename to analytics-datastore-clickhouse/configs/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml index b89c0adc..903b66c8 100644 --- a/analytics-datastore-clickhouse/cluster_configs/enable_keeper_01.xml +++ b/analytics-datastore-clickhouse/configs/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml @@ -1,30 +1,36 @@ - + + + information + /var/log/clickhouse-keeper/clickhouse-keeper.log + /var/log/clickhouse-keeper/clickhouse-keeper.err.log + 1000M + 3 + + 0.0.0.0 9181 1 /var/lib/clickhouse/coordination/log /var/lib/clickhouse/coordination/snapshots - 10000 30000 - trace + information - 1 - analytics-datastore-clickhouse-01 + clickhouse-keeper-01 9234 2 - analytics-datastore-clickhouse-02 + clickhouse-keeper-02 9234 3 - analytics-datastore-clickhouse-03 + clickhouse-keeper-03 9234 diff --git a/analytics-datastore-clickhouse/cluster_configs/enable_keeper_02.xml b/analytics-datastore-clickhouse/configs/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml similarity index 60% rename from analytics-datastore-clickhouse/cluster_configs/enable_keeper_02.xml rename to analytics-datastore-clickhouse/configs/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml index 20d9a362..cced46bb 100644 --- a/analytics-datastore-clickhouse/cluster_configs/enable_keeper_02.xml +++ b/analytics-datastore-clickhouse/configs/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml @@ -1,30 +1,36 @@ - + + + information + /var/log/clickhouse-keeper/clickhouse-keeper.log + /var/log/clickhouse-keeper/clickhouse-keeper.err.log + 1000M + 3 + + 0.0.0.0 9181 2 /var/lib/clickhouse/coordination/log /var/lib/clickhouse/coordination/snapshots - 10000 30000 - trace + information - 1 - analytics-datastore-clickhouse-01 + clickhouse-keeper-01 9234 2 - analytics-datastore-clickhouse-02 + clickhouse-keeper-02 9234 3 - analytics-datastore-clickhouse-03 + clickhouse-keeper-03 9234 diff --git a/analytics-datastore-clickhouse/cluster_configs/enable_keeper_03.xml b/analytics-datastore-clickhouse/configs/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml similarity index 60% rename from analytics-datastore-clickhouse/cluster_configs/enable_keeper_03.xml rename to analytics-datastore-clickhouse/configs/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml index 505f4563..b05c064d 100644 --- a/analytics-datastore-clickhouse/cluster_configs/enable_keeper_03.xml +++ b/analytics-datastore-clickhouse/configs/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml @@ -1,30 +1,36 @@ - + + + information + /var/log/clickhouse-keeper/clickhouse-keeper.log + /var/log/clickhouse-keeper/clickhouse-keeper.err.log + 1000M + 3 + + 0.0.0.0 9181 3 /var/lib/clickhouse/coordination/log /var/lib/clickhouse/coordination/snapshots - 10000 30000 - trace + information - 1 - analytics-datastore-clickhouse-01 + clickhouse-keeper-01 9234 2 - analytics-datastore-clickhouse-02 + clickhouse-keeper-02 9234 3 - analytics-datastore-clickhouse-03 + clickhouse-keeper-03 9234 diff --git a/analytics-datastore-clickhouse/docker-compose.cluster.dev.yml b/analytics-datastore-clickhouse/docker-compose.cluster.dev.yml index 4bac8f96..a1f48380 100644 --- a/analytics-datastore-clickhouse/docker-compose.cluster.dev.yml +++ b/analytics-datastore-clickhouse/docker-compose.cluster.dev.yml @@ -4,44 +4,44 @@ services: analytics-datastore-clickhouse-01: ports: - target: 8123 - published: 8124 + published: 8123 mode: host - target: 9000 - published: 9001 - mode: host - - target: 9181 - published: 9181 + published: 9000 mode: host + analytics-datastore-clickhouse-02: ports: - target: 8123 - published: 8125 + published: 8123 mode: host - target: 9000 - published: 9002 - mode: host - - target: 9181 - published: 9182 + published: 9000 mode: host + analytics-datastore-clickhouse-03: ports: - target: 8123 - published: 8126 + published: 8123 mode: host - target: 9000 - published: 9003 + published: 9000 mode: host + + clickhouse-keeper-01: + ports: - target: 9181 - published: 9183 + published: 9181 mode: host - analytics-datastore-clickhouse-04: + + clickhouse-keeper-02: ports: - - target: 8123 - published: 8127 - mode: host - - target: 9000 - published: 9004 + - target: 9181 + published: 9181 mode: host + + clickhouse-keeper-03: + ports: - target: 9181 - published: 9184 + published: 9181 mode: host diff --git a/analytics-datastore-clickhouse/docker-compose.cluster.yml b/analytics-datastore-clickhouse/docker-compose.cluster.yml index 9fd02064..4e1674c2 100644 --- a/analytics-datastore-clickhouse/docker-compose.cluster.yml +++ b/analytics-datastore-clickhouse/docker-compose.cluster.yml @@ -2,160 +2,108 @@ version: '3.9' services: analytics-datastore-clickhouse-01: - image: clickhouse/clickhouse-server - ulimits: - noFile: 262144 - volumes: - - clickhouse-data-01:/var/lib/clickhouse/ + image: clickhouse/clickhouse-server:latest + user: "101:101" + container_name: analytics-datastore-clickhouse-01 hostname: analytics-datastore-clickhouse-01 deploy: placement: constraints: - "node.labels.name==node-1" - configs: - - target: /etc/clickhouse-server/config.d/docker_related_config.xml - source: docker_related_config.xml - - target: /etc/clickhouse-server/config.d/enable_keeper.xml - source: clickhouse_enable_keeper_01.xml - - target: /etc/clickhouse-server/config.d/macros.xml - source: clickhouse_macros_01.xml - - target: /etc/clickhouse-server/config.d/remote_servers.xml - source: clickhouse_remote_servers.xml - - target: /etc/clickhouse-server/config.d/use_keeper.xml - source: clickhouse_use_keeper.xml + volumes: + - ${PWD}/configs/clickhouse-01/etc/clickhouse-server/config.d/config.xml:/etc/clickhouse-server/config.d/config.xml + - ${PWD}/configs/clickhouse-01/etc/clickhouse-server/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml + - clickhouse-data-01:/var/lib/clickhouse/ + depends_on: + - clickhouse-keeper-01 + - clickhouse-keeper-02 + - clickhouse-keeper-03 networks: public: default: analytics-datastore-clickhouse-02: - image: clickhouse/clickhouse-server + image: clickhouse/clickhouse-server:latest + user: "101:101" + container_name: analytics-datastore-clickhouse-02 hostname: analytics-datastore-clickhouse-02 deploy: placement: constraints: - "node.labels.name==node-2" - ulimits: - noFile: 262144 volumes: + - ${PWD}/configs/clickhouse-02/etc/clickhouse-server/config.d/config.xml:/etc/clickhouse-server/config.d/config.xml + - ${PWD}/configs/clickhouse-02/etc/clickhouse-server/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml - clickhouse-data-02:/var/lib/clickhouse/ - configs: - - target: /etc/clickhouse-server/config.d/docker_related_config.xml - source: docker_related_config.xml - - target: /etc/clickhouse-server/config.d/enable_keeper.xml - source: clickhouse_enable_keeper_02.xml - - target: /etc/clickhouse-server/config.d/macros.xml - source: clickhouse_macros_02.xml - - target: /etc/clickhouse-server/config.d/remote_servers.xml - source: clickhouse_remote_servers.xml - - target: /etc/clickhouse-server/config.d/use_keeper.xml - source: clickhouse_use_keeper.xml + depends_on: + - clickhouse-keeper-01 + - clickhouse-keeper-02 + - clickhouse-keeper-03 networks: public: default: analytics-datastore-clickhouse-03: - image: clickhouse/clickhouse-server + image: clickhouse/clickhouse-server:latest + user: "101:101" + container_name: analytics-datastore-clickhouse-03 hostname: analytics-datastore-clickhouse-03 deploy: placement: constraints: - "node.labels.name==node-3" - ulimits: - noFile: 262144 volumes: - - clickhouse-data-03:/var/lib/clickhouse/ - configs: - - target: /etc/clickhouse-server/config.d/docker_related_config.xml - source: docker_related_config.xml - - target: /etc/clickhouse-server/config.d/enable_keeper.xml - source: clickhouse_enable_keeper_03.xml - - target: /etc/clickhouse-server/config.d/macros.xml - source: clickhouse_macros_03.xml - - target: /etc/clickhouse-server/config.d/remote_servers.xml - source: clickhouse_remote_servers.xml - - target: /etc/clickhouse-server/config.d/use_keeper.xml - source: clickhouse_use_keeper.xml + - ${PWD}/configs/clickhouse-03/etc/clickhouse-server/config.d/config.xml:/etc/clickhouse-server/config.d/config.xml + - ${PWD}/configs/clickhouse-03/etc/clickhouse-server/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml + - clickhouse-data-03:/var/lib/clickhouse/ + depends_on: + - clickhouse-keeper-01 + - clickhouse-keeper-02 + - clickhouse-keeper-03 networks: public: default: - analytics-datastore-clickhouse-04: - image: clickhouse/clickhouse-server - hostname: analytics-datastore-clickhouse-04 - ulimits: - noFile: 262144 + clickhouse-keeper-01: + image: clickhouse/clickhouse-keeper:latest-alpine + user: "101:101" + container_name: clickhouse-keeper-01 + hostname: clickhouse-keeper-01 + deploy: + placement: + constraints: + - "node.labels.name==node-1" volumes: - - clickhouse-data-04:/var/lib/clickhouse/ - configs: - - target: /etc/clickhouse-server/config.d/docker_related_config.xml - source: docker_related_config.xml - - target: /etc/clickhouse-server/config.d/macros.xml - source: clickhouse_macros_04.xml - - target: /etc/clickhouse-server/config.d/remote_servers.xml - source: clickhouse_remote_servers.xml - - target: /etc/clickhouse-server/config.d/use_keeper.xml - source: clickhouse_use_keeper.xml - networks: - public: - default: + - ${PWD}/configs/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml + + clickhouse-keeper-02: + image: clickhouse/clickhouse-keeper:latest-alpine + user: "101:101" + container_name: clickhouse-keeper-02 + hostname: clickhouse-keeper-02 + deploy: + placement: + constraints: + - "node.labels.name==node-2" + volumes: + - ${PWD}/configs/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml + + clickhouse-keeper-03: + image: clickhouse/clickhouse-keeper:latest-alpine + user: "101:101" + container_name: clickhouse-keeper-03 + hostname: clickhouse-keeper-03 + deploy: + placement: + constraints: + - "node.labels.name==node-3" + volumes: + - ${PWD}/configs/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml volumes: clickhouse-data-01: clickhouse-data-02: clickhouse-data-03: - clickhouse-data-04: - -configs: - docker_related_config.xml: - file: ./cluster_configs/docker_related_config.xml - name: docker_related_config.xml-${docker_related_config_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_enable_keeper_01.xml: - file: ./cluster_configs/enable_keeper_01.xml - name: enable_keeper_01.xml-${enable_keeper_01_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_enable_keeper_02.xml: - file: ./cluster_configs/enable_keeper_02.xml - name: enable_keeper_02.xml-${enable_keeper_02_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_enable_keeper_03.xml: - file: ./cluster_configs/enable_keeper_03.xml - name: enable_keeper_03.xml-${enable_keeper_03_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_macros_01.xml: - file: ./cluster_configs/macros_01.xml - name: macros_01.xml-${macros_01_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_macros_02.xml: - file: ./cluster_configs/macros_02.xml - name: macros_02.xml-${macros_02_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_macros_03.xml: - file: ./cluster_configs/macros_03.xml - name: macros_03.xml-${macros_03_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_macros_04.xml: - file: ./cluster_configs/macros_04.xml - name: macros_04.xml-${macros_04_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_remote_servers.xml: - file: ./cluster_configs/remote_servers.xml - name: remote_servers.xml-${remote_servers_xml_DIGEST:?err} - labels: - name: clickhouse - clickhouse_use_keeper.xml: - file: ./cluster_configs/use_keeper.xml - name: use_keeper.xml-${use_keeper_xml_DIGEST:?err} - labels: - name: clickhouse networks: public: diff --git a/analytics-datastore-clickhouse/docker-compose.dev.yml b/analytics-datastore-clickhouse/docker-compose.dev.yml index 79c24f41..71e0bb1d 100644 --- a/analytics-datastore-clickhouse/docker-compose.dev.yml +++ b/analytics-datastore-clickhouse/docker-compose.dev.yml @@ -4,8 +4,8 @@ services: analytics-datastore-clickhouse: ports: - target: 8123 - published: 8124 + published: 8123 mode: host - target: 9000 - published: 9001 + published: 9000 mode: host diff --git a/analytics-datastore-clickhouse/docker-compose.yml b/analytics-datastore-clickhouse/docker-compose.yml index b5a050cd..baeb90a7 100644 --- a/analytics-datastore-clickhouse/docker-compose.yml +++ b/analytics-datastore-clickhouse/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.9' services: analytics-datastore-clickhouse: - image: clickhouse/clickhouse-server + image: clickhouse/clickhouse-server:latest ulimits: noFile: 262144 volumes: diff --git a/analytics-datastore-clickhouse/importer/config/clickhouseTables.js b/analytics-datastore-clickhouse/importer/config/clickhouseTables.js index 8c3ba4e7..bc5348d9 100644 --- a/analytics-datastore-clickhouse/importer/config/clickhouseTables.js +++ b/analytics-datastore-clickhouse/importer/config/clickhouseTables.js @@ -1,9 +1,9 @@ -const CLUSTERED_MODE = process.env.CLUSTERED_MODE || 'true'; +const CLUSTERED_MODE = process.env.CLUSTERED_MODE || "true"; const queries = Boolean(CLUSTERED_MODE) === true ? [ - `CREATE TABLE default_table( + `CREATE TABLE my_table( createdAt Date, updatedAt Date ) @@ -11,12 +11,16 @@ const queries = ORDER BY tuple();`, ] : [ - `CREATE TABLE default.default_table ON CLUSTER '{cluster}' ( + // Replicated table + `CREATE TABLE default.my_table ON CLUSTER '{cluster}' ( createdAt Date, updatedAt Date ) - ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{shard}/{table}', '{replica}') + ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{shard}/my_table', '{replica}') ORDER BY tuple();`, + // Distributed table : Writes and queries should be made against this table + `CREATE TABLE default.my_table_distributed ON CLUSTER '{cluster}' AS default.my_table + ENGINE = Distributed('{cluster}', default, my_table, rand())`, ]; module.exports = queries; diff --git a/analytics-datastore-clickhouse/package-metadata.json b/analytics-datastore-clickhouse/package-metadata.json index 680a3bb7..eadb176a 100644 --- a/analytics-datastore-clickhouse/package-metadata.json +++ b/analytics-datastore-clickhouse/package-metadata.json @@ -3,7 +3,7 @@ "name": "Analytics Datastore Clickhouse", "description": "A column database", "type": "infrastructure", - "version": "0.0.1", + "version": "0.0.2", "dependencies": [], "environmentVariables": { "CLICKHOUSE_HOST": "analytics-datastore-clickhouse",