Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reconfigurator] initialize clickhouse cluster db schema #7306

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

karencfv
Copy link
Contributor

@karencfv karencfv commented Jan 6, 2025

This commit allows reconfigurator to initialise the oximeter DB schema on a replicated cluster via clickhouse admin.

Tested by deploying Omicron locally and setting/enabling the clickhouse policy to "both"

$ zoneadm list
global
sidecar_softnpu
oxz_switch
oxz_internal_dns_e79062f1-0562-4866-84cc-30741f4b44f3
oxz_internal_dns_125f2a03-9206-4f6c-97fe-56d62626d1be
oxz_internal_dns_a7007297-7150-40cd-83e4-0fec9a02e051
oxz_ntp_576a6dc7-7f33-4ffc-9f77-e998eeac41a5
oxz_cockroachdb_d3caaaa3-4115-4789-8f05-af09f494c8c8
oxz_cockroachdb_f5840cbe-0218-45c4-a259-8eb455814fc7
oxz_cockroachdb_48d7a4e6-0a38-4a86-888e-4349412a5933
oxz_cockroachdb_58b2c1f3-b6f5-4391-88cd-6e976bdbd00b
oxz_cockroachdb_a627c4bb-9681-46dd-bdc7-219bcffe5d33
oxz_crucible_53530a3a-165a-4722-bd22-029ee961f5ff
oxz_crucible_2308e266-39f5-4d40-b9f2-d47b214cd8c3
oxz_crucible_382a33a1-258e-4793-bf31-01c5a07720e2
oxz_crucible_10d3cb3e-bbb7-45ac-80b0-a7e47415123c
oxz_crucible_058adb53-ce33-4fe6-92cb-6d6759af7643
oxz_crucible_6d44a11d-be4d-4c48-8744-dc978fa1263a
oxz_crucible_pantry_69e56321-1d5f-42ed-8285-3ff50bdf7f4c
oxz_external_dns_28ddebab-352c-48be-a26f-403218c11639
oxz_crucible_2fc57911-8177-4957-9920-4717e847a300
oxz_nexus_c31317d6-e072-40f7-a7ba-7c3bab3b30ee
oxz_crucible_02bca09d-5886-4a1d-91b6-9ee86b6a2c4b
oxz_crucible_pantry_1b24234a-aed6-446a-94ba-38573f097d2d
oxz_crucible_a3ccf208-d678-4e1d-a24c-a8bacf69266a
oxz_crucible_pantry_7dbc74c7-a8a0-4292-bc45-9ba0d0b70a7d
oxz_oximeter_85d30f98-950a-4c2f-979a-10a4de75b16d
oxz_external_dns_23ed7c7c-4244-4fe3-90bd-74e212f33626
oxz_nexus_02670c10-c872-4ab8-950a-f1c8dda67328
oxz_nexus_bdf0c647-82b8-45c0-a9ed-df408f21316d
oxz_clickhouse_2a3e6b87-80a9-484f-b4ce-5359cc6be7ff
oxz_clickhouse_keeper_84a8be56-3354-4afa-852d-c85dab34f8f9
oxz_clickhouse_keeper_a44cee3f-9917-4ba6-a45f-f5c03e04c782
oxz_clickhouse_keeper_5f3e655e-4927-43b9-b45d-bf8f5d957aa7
oxz_clickhouse_keeper_bdf37cf4-c043-4845-9fd4-3e64cacd3f13
oxz_clickhouse_server_3847cf44-55a0-41e1-bfbd-0c954637423a
oxz_clickhouse_server_607aa891-0808-4a78-ba9c-7d53b7d99af1
oxz_clickhouse_keeper_b7d86a07-695a-4d6c-95d1-228b668020de
oxz_clickhouse_server_23012e68-1fab-4a2d-beee-acba56e0eb7f
root@oxz_clickhouse_server_3847cf44:~# /opt/oxide/clickhouse_server/clickhouse client --host fd00:1122:3344:101::27
ClickHouse client version 23.8.7.1.
Connecting to fd00:1122:3344:101::27:9000 as user default.
Connected to ClickHouse server version 23.8.7 revision 54465.

oximeter_cluster_2 :) SHOW DATABASES

SHOW DATABASES

Query id: 10b0eb8f-9fa9-411b-be66-70d68940551c

┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ default            │
│ information_schema │
│ oximeter           │
│ system             │
└────────────────────┘

5 rows in set. Elapsed: 0.003 sec. 

oximeter_cluster_2 :) SHOW TABLES in oximeter

SHOW TABLES FROM oximeter

Query id: cbc8c338-6a04-4577-9255-140287d3ba1e

┌─name─────────────────────────────┐
│ fields_bool                      │
│ fields_bool_local                │
│ fields_i16                       │
│ fields_i16_local                 │
│ fields_i32                       │
│ fields_i32_local                 │
│ fields_i64                       │
│ fields_i64_local                 │
│ fields_i8                        │
│ fields_i8_local                  │
│ fields_ipaddr                    │
│ fields_ipaddr_local              │
│ fields_string                    │
│ fields_string_local              │
│ fields_u16                       │
│ fields_u16_local                 │
│ fields_u32                       │
│ fields_u32_local                 │
│ fields_u64                       │
│ fields_u64_local                 │
│ fields_u8                        │
│ fields_u8_local                  │
│ fields_uuid                      │
│ fields_uuid_local                │
│ measurements_bool                │
│ measurements_bool_local          │
│ measurements_bytes               │
│ measurements_bytes_local         │
│ measurements_cumulativef32       │
│ measurements_cumulativef32_local │
│ measurements_cumulativef64       │
│ measurements_cumulativef64_local │
│ measurements_cumulativei64       │
│ measurements_cumulativei64_local │
│ measurements_cumulativeu64       │
│ measurements_cumulativeu64_local │
│ measurements_f32                 │
│ measurements_f32_local           │
│ measurements_f64                 │
│ measurements_f64_local           │
│ measurements_histogramf32        │
│ measurements_histogramf32_local  │
│ measurements_histogramf64        │
│ measurements_histogramf64_local  │
│ measurements_histogrami16        │
│ measurements_histogrami16_local  │
│ measurements_histogrami32        │
│ measurements_histogrami32_local  │
│ measurements_histogrami64        │
│ measurements_histogrami64_local  │
│ measurements_histogrami8         │
│ measurements_histogrami8_local   │
│ measurements_histogramu16        │
│ measurements_histogramu16_local  │
│ measurements_histogramu32        │
│ measurements_histogramu32_local  │
│ measurements_histogramu64        │
│ measurements_histogramu64_local  │
│ measurements_histogramu8         │
│ measurements_histogramu8_local   │
│ measurements_i16                 │
│ measurements_i16_local           │
│ measurements_i32                 │
│ measurements_i32_local           │
│ measurements_i64                 │
│ measurements_i64_local           │
│ measurements_i8                  │
│ measurements_i8_local            │
│ measurements_string              │
│ measurements_string_local        │
│ measurements_u16                 │
│ measurements_u16_local           │
│ measurements_u32                 │
│ measurements_u32_local           │
│ measurements_u64                 │
│ measurements_u64_local           │
│ measurements_u8                  │
│ measurements_u8_local            │
│ timeseries_schema                │
│ timeseries_schema_local          │
│ version                          │
└──────────────────────────────────┘

81 rows in set. Elapsed: 0.005 sec. 

oximeter_cluster_2 :) exit
Bye.
root@oxz_clickhouse_server_607aa891:~# /opt/oxide/clickhouse_server/clickhouse client --host fd00:1122:3344:101::26
ClickHouse client version 23.8.7.1.
Connecting to fd00:1122:3344:101::26:9000 as user default.
Connected to ClickHouse server version 23.8.7 revision 54465.

oximeter_cluster_3 :) SHOW DATABASES

SHOW DATABASES

Query id: bf3f7d69-e829-415c-8737-cef2f68e1f46

┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ default            │
│ information_schema │
│ oximeter           │
│ system             │
└────────────────────┘

5 rows in set. Elapsed: 0.004 sec. 

oximeter_cluster_3 :) SHOW TABLES in oximeter

SHOW TABLES FROM oximeter

Query id: 46358626-5f25-437b-a1d7-c89b0aa34807

┌─name─────────────────────────────┐
│ fields_bool                      │
│ fields_bool_local                │
│ fields_i16                       │
│ fields_i16_local                 │
│ fields_i32                       │
│ fields_i32_local                 │
│ fields_i64                       │
│ fields_i64_local                 │
│ fields_i8                        │
│ fields_i8_local                  │
│ fields_ipaddr                    │
│ fields_ipaddr_local              │
│ fields_string                    │
│ fields_string_local              │
│ fields_u16                       │
│ fields_u16_local                 │
│ fields_u32                       │
│ fields_u32_local                 │
│ fields_u64                       │
│ fields_u64_local                 │
│ fields_u8                        │
│ fields_u8_local                  │
│ fields_uuid                      │
│ fields_uuid_local                │
│ measurements_bool                │
│ measurements_bool_local          │
│ measurements_bytes               │
│ measurements_bytes_local         │
│ measurements_cumulativef32       │
│ measurements_cumulativef32_local │
│ measurements_cumulativef64       │
│ measurements_cumulativef64_local │
│ measurements_cumulativei64       │
│ measurements_cumulativei64_local │
│ measurements_cumulativeu64       │
│ measurements_cumulativeu64_local │
│ measurements_f32                 │
│ measurements_f32_local           │
│ measurements_f64                 │
│ measurements_f64_local           │
│ measurements_histogramf32        │
│ measurements_histogramf32_local  │
│ measurements_histogramf64        │
│ measurements_histogramf64_local  │
│ measurements_histogrami16        │
│ measurements_histogrami16_local  │
│ measurements_histogrami32        │
│ measurements_histogrami32_local  │
│ measurements_histogrami64        │
│ measurements_histogrami64_local  │
│ measurements_histogrami8         │
│ measurements_histogrami8_local   │
│ measurements_histogramu16        │
│ measurements_histogramu16_local  │
│ measurements_histogramu32        │
│ measurements_histogramu32_local  │
│ measurements_histogramu64        │
│ measurements_histogramu64_local  │
│ measurements_histogramu8         │
│ measurements_histogramu8_local   │
│ measurements_i16                 │
│ measurements_i16_local           │
│ measurements_i32                 │
│ measurements_i32_local           │
│ measurements_i64                 │
│ measurements_i64_local           │
│ measurements_i8                  │
│ measurements_i8_local            │
│ measurements_string              │
│ measurements_string_local        │
│ measurements_u16                 │
│ measurements_u16_local           │
│ measurements_u32                 │
│ measurements_u32_local           │
│ measurements_u64                 │
│ measurements_u64_local           │
│ measurements_u8                  │
│ measurements_u8_local            │
│ timeseries_schema                │
│ timeseries_schema_local          │
│ version                          │
└──────────────────────────────────┘

81 rows in set. Elapsed: 0.006 sec. 

oximeter_cluster_3 :) exit
Bye.
root@oxz_clickhouse_server_23012e68:~# /opt/oxide/clickhouse_server/clickhouse client --host fd00:1122:3344:101::28
ClickHouse client version 23.8.7.1.
Connecting to fd00:1122:3344:101::28:9000 as user default.
Connected to ClickHouse server version 23.8.7 revision 54465.

oximeter_cluster_1 :) SHOW DATABASES

SHOW DATABASES

Query id: f5408b05-4bb9-4b8c-b27c-820cc50eaa56

┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ default            │
│ information_schema │
│ oximeter           │
│ system             │
└────────────────────┘

5 rows in set. Elapsed: 0.005 sec. 

oximeter_cluster_1 :) SHOW TABLES IN oximeter

SHOW TABLES FROM oximeter

Query id: fb3533c3-2309-4ad8-8b8a-5cc9d4e2c4e7

┌─name─────────────────────────────┐
│ fields_bool                      │
│ fields_bool_local                │
│ fields_i16                       │
│ fields_i16_local                 │
│ fields_i32                       │
│ fields_i32_local                 │
│ fields_i64                       │
│ fields_i64_local                 │
│ fields_i8                        │
│ fields_i8_local                  │
│ fields_ipaddr                    │
│ fields_ipaddr_local              │
│ fields_string                    │
│ fields_string_local              │
│ fields_u16                       │
│ fields_u16_local                 │
│ fields_u32                       │
│ fields_u32_local                 │
│ fields_u64                       │
│ fields_u64_local                 │
│ fields_u8                        │
│ fields_u8_local                  │
│ fields_uuid                      │
│ fields_uuid_local                │
│ measurements_bool                │
│ measurements_bool_local          │
│ measurements_bytes               │
│ measurements_bytes_local         │
│ measurements_cumulativef32       │
│ measurements_cumulativef32_local │
│ measurements_cumulativef64       │
│ measurements_cumulativef64_local │
│ measurements_cumulativei64       │
│ measurements_cumulativei64_local │
│ measurements_cumulativeu64       │
│ measurements_cumulativeu64_local │
│ measurements_f32                 │
│ measurements_f32_local           │
│ measurements_f64                 │
│ measurements_f64_local           │
│ measurements_histogramf32        │
│ measurements_histogramf32_local  │
│ measurements_histogramf64        │
│ measurements_histogramf64_local  │
│ measurements_histogrami16        │
│ measurements_histogrami16_local  │
│ measurements_histogrami32        │
│ measurements_histogrami32_local  │
│ measurements_histogrami64        │
│ measurements_histogrami64_local  │
│ measurements_histogrami8         │
│ measurements_histogrami8_local   │
│ measurements_histogramu16        │
│ measurements_histogramu16_local  │
│ measurements_histogramu32        │
│ measurements_histogramu32_local  │
│ measurements_histogramu64        │
│ measurements_histogramu64_local  │
│ measurements_histogramu8         │
│ measurements_histogramu8_local   │
│ measurements_i16                 │
│ measurements_i16_local           │
│ measurements_i32                 │
│ measurements_i32_local           │
│ measurements_i64                 │
│ measurements_i64_local           │
│ measurements_i8                  │
│ measurements_i8_local            │
│ measurements_string              │
│ measurements_string_local        │
│ measurements_u16                 │
│ measurements_u16_local           │
│ measurements_u32                 │
│ measurements_u32_local           │
│ measurements_u64                 │
│ measurements_u64_local           │
│ measurements_u8                  │
│ measurements_u8_local            │
│ timeseries_schema                │
│ timeseries_schema_local          │
│ version                          │
└──────────────────────────────────┘

81 rows in set. Elapsed: 0.006 sec. 

oximeter_cluster_1 :) exit
Bye.

Closes: #7060

@karencfv karencfv marked this pull request as ready for review January 8, 2025 04:13
@karencfv karencfv requested a review from andrewjstone January 8, 2025 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialize clickhouse cluster schema via clickhouse-admin
1 participant