Skip to content
sh
#! /bin/bash
HS_HOME=/home/centos/workspace/hengshi-java/hengshi
PG_HOME=$HS_HOME/lib/pgsql
export PATH=$PATH:$PG_HOME/bin

PG_USR=postgres
PG_PWD=postgres
PG_HOST=127.0.0.1
PG_PORT=5434

# ------------ meta ------------
backup_meta() {
    local dbname="$1"
    echo "PGPASSOWRD=$PG_PWD pg_dump -U$PG_USR -h$PG_HOST -p$PG_PORT $dbname > $dbname.backup.sql"
    PGPASSOWRD=$PG_PWD pg_dump -U$PG_USR -h$PG_HOST -p$PG_PORT $dbname > $dbname.backup.sql
}

# ------ engine ------------
ENGINE_HOME=$HS_HOME/engine-cluster
backup_engine() {
    source $ENGINE_HOME/export-cluster.sh
    echo "engine: pg_dumpall"
    pg_dumpall > engine.back.sql
}

# ------- run -----------
backup_meta postgres
backup_meta hengshi_sense_internal_storage

backup_engine

衡石分析平台使用手册