oneuptime/HelmChart/Docs/Clickhouse.md
Simon Larsen 9054c49b3e
refactor: Update Kubernetes secret retrieval commands
The code changes update the commands used to retrieve secrets from Kubernetes. The previous commands were using the deprecated `go-template` option, which has been replaced with the `jsonpath` option. This refactor ensures that the correct commands are used to retrieve the secrets, improving the reliability and maintainability of the code.
2024-06-06 18:36:05 +01:00

954 B

Clickhouse Ops

To access clickhouse use port forwarding in kubernetes

kubectl port-forward --address 0.0.0.0 service/oneuptime-oneuptime 8123:8123

then you should be able to access from the localhost and port 8123

# Username for Postgres user is `oneuptime`
echo $(kubectl get secret --namespace "default" oneuptime-clickhouse -o jsonpath="{.data.admin-password}" | base64 -d)

Important: Please ignore % in the end of the password output.

Basic Ops Queries

Check Size of Tables in Clickhouse

SELECT
    database,
    table,
    formatReadableSize(sum(data_compressed_bytes) AS size) AS compressed,
    formatReadableSize(sum(data_uncompressed_bytes) AS usize) AS uncompressed,
    round(usize / size, 2) AS compr_rate,
    sum(rows) AS rows,
    count() AS part_count
FROM system.parts
WHERE (active = 1) AND (database LIKE '%') AND (table LIKE '%')
GROUP BY
    database,
    table
ORDER BY size DESC;