This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
#! /bin/sh
#
# Description: PostgreSQL streaming repliation node failover script
# - promote execute
#
# Author: Solbox Storage dev team
# - storage.sd@solbox.com
## EDIT FROM HERE
# Installation prefix
prefix=/user/db/pgsql
# Data directory
PGDATA="$prefix/data"
# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=pgsql
## STOP EDITING HERE
# PID file
PIDFILE="$PGDATA/postmaster.pid"
# What to use to control command the postmaster
PGCTL="$prefix/bin/pg_ctl"
# Stnadby DB recovery.conf file
STANDBYDBCONF="$PGDATA/recovery.conf"
# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Parse command line parameters.
case $1 in
start)
# DB active and promote => normal
# etc => error
if [ -f $PIDFILE ] ; then
echo -n "Starting PostgreSQL Promote: "
su - $PGUSER -c "$PGCTL promote"
else
echo "Error: PostgreSQL is already stopped."
exit 1
fi
;;
stop)
echo -n "Stopping PostgreSQL: "
su - $PGUSER -c "$PGCTL stop --mode=fast"
echo "OK"
;;
status)
# Normal staus => print OK
# - DB active (pid exist )
# - AND Primary mode (recovery.conf not exist)
# Error status
# - etc ( DB not started or Standby mode )
if [ -f $PIDFILE ] ; then
if [ ! -f $STANDBYDBCONF ] ; then
echo "PostgreSQL running as a primary [OK]"
else
echo "PostgreSQL is standby status."
fi
else
echo "PostgreSQL is already stopped."
fi
;;
*)
# Print help
echo "Usage: $0 {start|stop|status}" 1>&2
exit 1
;;
esac
exit 0
+24
View File
@@ -0,0 +1,24 @@
각 스크립트 설명 및 사용법
============================
[RcdbFailover]
Heartbeat 를 이용한 RCDB 이중화 구성시
Heartbeat 을 통한 RCDB Failover 수행을 담당하기 위한 스크립트
본 스크립트는 Cloud Storage 의 RCDB 설치 패키지에 포함되어 배포된다.
1. 설치 경로
/etc/ha.d/resource.d
2. 설치 권한
-rwxr-xr-x 1 root root 1565 2014-08-28 19:17 RcdbFailover
3. 주의 사항
- 설치 전 Linux Heartbeat 가 먼저 설치되어 있어야 한다.
- PostgreSQL RCDB 가 /user/db/pgsql 기본 경로에 설치되어야 정상 동작한다.
( 기본 경로를 사용하지 않을 경우 스크립트 수정 필요)
-----------------------------