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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: CronJob | |
metadata: | |
name: clickhouse-backup-cron | |
spec: | |
# every day at 00:00 | |
# schedule: "0 0 * * *" | |
schedule: "* * * * *" | |
concurrencyPolicy: "Forbid" | |
jobTemplate: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<yandex> | |
<default><access_management>1</access_management></default> | |
</yandex> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"context" | |
"fmt" | |
"io" | |
"net/http" | |
"path" | |
"strings" | |
"time" | |
"cloud.google.com/go/storage" |
NewerOlder