Skip to content

Instantly share code, notes, and snippets.

View Slach's full-sized avatar
💭
deep diving into kuberntes

Eugene Klimov Slach

💭
deep diving into kuberntes
View GitHub Profile
@Slach
Slach / backup-cronjob.yaml
Created April 16, 2024 13:17
clickhouse-backup CronJob examples
apiVersion: batch/v1
kind: CronJob
metadata:
name: clickhouse-backup-cron
spec:
# every day at 00:00
# schedule: "0 0 * * *"
schedule: "* * * * *"
concurrencyPolicy: "Forbid"
jobTemplate:
@Slach
Slach / ai-oracle.ipynb
Created April 15, 2024 05:36
ai-oracle
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Slach
Slach / clickhouse-keeper.xml
Created December 27, 2023 14:24
reproduce ALTER TABLE FREEZE for encrypted over s3 disk for ReplicatedMergeTree
<clickhouse>
<listen_host replace="replace">0.0.0.0</listen_host>
<logger>
<console>1</console>
</logger>
<keeper_server>
<tcp_port>2181</tcp_port>
</keeper_server>
</clickhouse>
@Slach
Slach / checksum_parser.sh
Last active November 19, 2023 09:13
clickhouse checksums.txt parser in bash
CHECKSUM_FILE=$1
if [[ "ENC" == $(dd if="${CHECKSUM_FILE}" bs=1 skip="0" count="3" 2>/dev/null) ]]; then
echo "ENCRYPTED FILES don't supported"
exit 0
fi
FORMAT_VERSION=$(head -n +1 "${CHECKSUM_FILE}" | sed 's/checksums format version: //g')
log() { printf '%s\n' "$*"; }
error() { log "ERROR: $*" >&2; }
fatal() { error "$@"; exit 1; }
@Slach
Slach / .gitignore
Last active November 17, 2023 06:41
try to upgrade statefulset image without restart all clusters
*.yaml
@Slach
Slach / docker-compose.yaml
Created October 24, 2023 18:16
add XML users grants example
services:
clickhouse:
image: ${CLICKHOUSE_IMAGE:-clickhouse/clickhouse-server}:${CLICKHOUSE_VERSION:-latest}
volumes:
- ./xml_user_grants.xml:/etc/clickhouse-server/users.d/xml_user_grants.xml
@Slach
Slach / access_management.xml
Created October 25, 2021 07:11
ClickHouse Schema Migration control
<yandex>
<default><access_management>1</access_management></default>
</yandex>
@Slach
Slach / create.sh
Created October 7, 2021 12:57
clickhouse-backup selective create_remote \ restore_remote
#!/bin/bash
backup_date=$(date +%Y-%m-%d-%H-%M-%S)
table_patterns=$1 # for example table_patterns="ns_v2.t_agg_page_h0?_local"
backup_name="full-$backup_date"
backup_command="create_remote --tables=$table_patterns $backup_name"
echo "RUN ${backup_command}"
echo "{\"command\":\"${backup_command}\"}" | curl -XPOST "http://localhost:7171/backup/actions" --data-binary=@-
while [[ "0" == $(curl -s "http://localhost:7171/backup/status" | grep -F "${backup_command}" | grep -c "success|error") ]]; do
printf "."
@Slach
Slach / sample.go
Created October 1, 2021 12:03
Google Cloud Storage (GCS) debug options
import (
"context"
"fmt"
"io"
"net/http"
"path"
"strings"
"time"
"cloud.google.com/go/storage"
@Slach
Slach / README.md
Last active September 14, 2021 12:52
clickhouse-backup diff every hour

howto install this example?

mkdir -p /opt/clikchouse-backup-diff/
git clone https://gist.github.com/d6390005975b9643344e9ee935fa882a /opt/clikchouse-backup-diff/
chmod +x /opt/clikchouse-backup-diff/*.sh
cp -fv /opt/clikchouse-backup-diff/cron_example.txt /etc/cron.d/clickhouse_backup_diff
cp -fv /opt/clikchouse-backup-diff/clickhouse-backup-config-example.yml /etc/clickhouse-backup/config.yml