You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
# put this script into /opt/clickhouse-backup-diff/clickhouse-backup-cron.sh, and don't forget chmod +x /opt/clickhouse-backup-diff/clickhouse-backup-cron.sh
set +x
run_diff=$1
backup_date=$(date +%Y-%m-%d-%H-%M-%S)
if [[ "run_diff" == "${run_diff}" && "2" -le "$(clickhouse-backup list local | wc -l)" ]]; then
echo "create diff local backup"
clickhouse-backup create "diff-${backup_date}"
echo "upload backup as diff from previous backup, when we run with 'run_diff' parameter"
clickhouse-backup upload --diff-from "$(clickhouse-backup list local | tail -n 2 | head -n 1 | cut -d " " -f 1)" "diff-${backup_date}"
elif [[ "" == "${run_diff}" ]]; then
echo "create full local backup"
clickhouse-backup create "full-${backup_date}"
echo "upload backup as full, and remove all old backups to avoid allocate too much extra space cause hardlinks will still allocate disk space even after data parts merged in background"
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
set +x
run_diff=$1
backup_date=$(date +%Y-%M-%d-%H-%M-%S)
if [[ "run_diff" == "${run_diff}" && "2" -le "$(clickhouse-backup list local | wc -l)" ]]; then
echo "create diff local backup"
clickhouse-backup create --tables=BBYFlow.aggFlowsFive_local_table,BBYFlow.aggFlowsFive_local_v1,BBYFlow.aggFlowsHour_local,BBYFlow.aggFlowsHour_local_table,BBYFlow.aggFlowsPrefix_local,BBYFlow.aggFlowsPrefix_local_table "diff-${backup_date}"
echo "upload backup as diff from previous backup, when we run with 'run_diff' parameter"
clickhouse-backup upload --diff-from "$(clickhouse-backup list local | tail -n 2 | head -n 1 | cut -d " " -f 1)" "diff-${backup_date}"
elif [[ "" == "${run_diff}" ]]; then
echo "create full local backup"
clickhouse-backup create --tables=BBYFlow.aggFlowsFive_local_table,BBYFlow.aggFlowsFive_local_v1,BBYFlow.aggFlowsHour_local,BBYFlow.aggFlowsHour_local_table,BBYFlow.aggFlowsPrefix_local,BBYFlow.aggFlowsPrefix_local_table "full-${backup_date}"
echo "upload backup as full, and remove all old backups to avoid allocate too much extra space cause hardlinks will still allocate disk space even after data parts merged in background"
clickhouse-backup upload "full-${backup_date}"
fi
clickhouse /bin/clickhouse-backup-cron.sh run_diff not giving any output