Skip to content

Commit 7367f3d

Browse files
committed
chore(monitor): add timeseries database
1 parent 8288064 commit 7367f3d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

charts/monitor/templates/_helpers.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ env:
9494
{{- if (.Values.telegraf.postgresqlConnection) }}
9595
- name: POSTGRESQL_CONNECTION
9696
value: {{ .Values.telegraf.postgresqlConnection }}
97-
{{- else if eq .Values.global.databaseLocation "on-cluster" }}
97+
{{- else if eq .Values.global.timeseriesLocation "on-cluster" }}
9898
- name: PG_USER
9999
valueFrom:
100100
secretKeyRef:
101-
name: database-creds
101+
name: timeseries-creds
102102
key: user
103103
- name: PG_PASSWORD
104104
valueFrom:
105105
secretKeyRef:
106-
name: database-creds
106+
name: timeseries-creds
107107
key: password
108108
- name: POSTGRESQL_CONNECTION
109-
value: "postgres://$(PG_USER):$(PG_PASSWORD)@drycc-database.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/monitor"
109+
value: "postgres://$(PG_USER):$(PG_PASSWORD)@drycc-timeseries.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/monitor"
110110
{{- end }}
111111
{{- end }}

telegraf/rootfs/home/telegraf/config.toml.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
tags_as_foreign_keys = true
6262
create_templates = [
6363
'''{{`CREATE TABLE {{ .table }} ({{ .columns }})`}}''',
64-
'''{{`SELECT create_hypertable({{ .table|quoteLiteral }}, 'time', chunk_time_interval => INTERVAL '7 days')`}}''',
64+
'''{{`SELECT create_distributed_hypertable({{ .table|quoteLiteral }}, 'time', partitioning_column => 'tag_id', number_partitions => (SELECT count(*) FROM timescaledb_information.data_nodes)::integer, replication_factor => 2, chunk_time_interval => INTERVAL '7d')`}}''',
6565
'''{{`ALTER TABLE {{ .table }} SET (timescaledb.compress, timescaledb.compress_segmentby = 'tag_id')`}}''',
6666
'''{{`SELECT add_retention_policy({{ .table|quoteLiteral }}, INTERVAL '1 months')`}}''',
6767
'''{{`SELECT add_compression_policy({{ .table|quoteLiteral }}, INTERVAL '2 hours')`}}''',

0 commit comments

Comments
 (0)