Synchrony 독립형 클러스터 구성
이 가이드는 Confluence Data Center 6.5 이상에 적용됩니다. 이전 버전의 Data Center를 사용하는 경우 Confluence 6.4 및 이전 버전의 Linux에서 Synchrony 독립형을 서비스로 실행을 참조.
개요
Confluence Data Center 6.5 이상에서 사용하기 위해 Linux의 독립형 노드 또는 클러스터에서 Synchrony를 서비스로 실행하는 방법을 설명합니다.
독립형 노드에서 Synchrony를 서비스로 실행 방법
1. Synchrony 홈 디렉터리 생성 및 구성
디렉토리 구성
sudo mkdir -p /opt/atlassian/synchrony
Synchrony 홈 디렉터리 구성
# Synchrony 디렉토리 복사
$ cp -r <Confluence Install Directory>/bin/synchrony <Synchrony Home Directory>
# Synchrony 파일 복사
$ cp <Confluence Home Directory>/synchrony-standalone.jar <Synchrony Home Directory>
# 데이터 베이스 드라이버 복사
$ cp <Confluence Install Directory>/confluence/WEB-INF/lib/<Database Driver> <Synchrony Home Directory>
Synchrony 홈 디렉토리 리스트
synchrony-standalone.jar
start-synchrony.sh
stop-synchrony.sh
install_synchrony_service.sh
<Database Driver> 예)
postgresql-9.4.1212.jar
2. Synchrony 설정
vi <Synchrony Home Directory>/start-synchrony.sh
필수 속성
Property name | Description |
---|---|
SERVER_IP | Synchrony 노드의 공용 IP 주소 또는 호스트 이름 |
DATABASE_URL | Confluence 데이터베이스의 URL |
DATABASE_USER | Confluence 데이터베이스 사용자 이름 |
DATABASE_PASSWORD | Confluence 데이터베이스 사용자 비밀번호 |
CLUSTER_JOIN_PROPERTIES | Synchrony가 노드를 발견하는 방법
|
DATABASE_DRIVER_PATH | 데이터베이스 드라이버 파일의 경로 |
SYNCHRONY_JAR_PATH |
|
SYNCHRONY_URL | 브라우저가 Synchrony에 연결하는 데 사용하는 URL |
OPTIONAL_OVERRIDES | 추가 시스템 속성을 지정하도록 선택 |
start-synchrony.sh 구성 예시
#!/bin/bash
# Parse the Synchrony home folder from the script location
#SYNCHRONY_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SYNCHRONY_HOME="/opt/datacenter/atlassian/synchrony"
################################## Parameters to configure ##################################
SERVER_IP="14.36.48.220"
DATABASE_URL="jdbc:postgresql://14.36.48.220:5432/dcwikidb"
DATABASE_USER="dcwikidbuser"
DATABASE_PASSWORD="dcwikidbuser"
# # Uncomment this section if you want to do node discovery using TCP/IP
# # Comma separated list of IP addresses for each cluster node
TCPIP_MEMBERS="14.36.48.220,175.197.124.236"
CLUSTER_JOIN_PROPERTIES="\
-Dcluster.join.type=tcpip \
-Dcluster.join.tcpip.members=${TCPIP_MEMBERS}"
# Locations of the synchrony-standalone.jar and database driver jar
DATABASE_DRIVER_PATH="/opt/datacenter/atlassian/synchrony/#postgresql-42.2.8.jar"
SYNCHRONY_JAR_PATH="/opt/datacenter/atlassian/synchrony/synchrony-standalone.jar"
SYNCHRONY_URL="http://dcconfluence.twoseed.co.kr:7091/synchrony"
OPTIONAL_OVERRIDES="-Dsynchrony.port=7091 -Dcluster.listen.port=6851"
# Path to file where Synchrony PID will be stored
# If you change this, you'll also need to set this value in 'stop-synchrony.sh'
SYNCHRONY_PID_FILE="${SYNCHRONY_HOME}/synchrony.pid"
# Optionally configure JVM
JAVA_BIN="java"
JAVA_OPTS="-Xms2048m -Xmx2g"
#############################################################################################
# check for help prompt or if user has tried to run the script without editing it
if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ -z "${CLUSTER_JOIN_PROPERTIES}" ]; then
echo "Edit this file to provide Synchrony information on how to run."
echo "Then simply run 'start-synchrony.sh' or 'start-synchrony.sh -fg' (to run the process in the foreground)"
echo "For more information about configuring Synchrony, visit https://confluence.atlassian.com/display/DOC/Configuring+Synchrony+for+Data+Center"
exit
fi
# don't try to start Synchrony if another process is already running
if [ ! -z "${SYNCHRONY_PID_FILE}" ] && [ -f "${SYNCHRONY_PID_FILE}" ]; then
if [ -s "${SYNCHRONY_PID_FILE}" ] && [ -r "${SYNCHRONY_PID_FILE}" ]; then
PID=$(cat ${SYNCHRONY_PID_FILE})
if [ ! -z "${PID}" ]; then
process=$(ps -fp "${PID}" | grep synchrony.core)
if [ -z "${process}" ]; then
echo "Unable to find Synchrony process with corresponding PID. Removing synchrony.pid file!"
rm -f "${SYNCHRONY_PID_FILE}" >/dev/null 2>&1
else
echo "Synchrony appears to still be running with PID ${PID}. Start aborted."
echo "If the following process is not a Synchrony process, remove ${SYNCHRONY_PID_FILE} and try again."
ps -f -p "${PID}"
exit 1
fi
fi
else
echo "Please remove ${SYNCHRONY_PID_FILE} and try to start Synchrony again."
exit 1
fi
fi
# try to source env file if it exists
if [ -f "${SYNCHRONY_ENV_FILE}" ]; then
if [ -x "${SYNCHRONY_ENV_FILE}" ]; then
source ${SYNCHRONY_ENV_FILE}
else
echo "Synchrony environment file ${SYNCHRONY_ENV_FILE} exists, but isn't executable."
echo "If you want to set Synchrony properties this way, stop Synchrony and adjust the file format accordingly."
fi
fi
_RUNJAVA="${JAVA_BIN} ${JAVA_OPTS}"
SYNCHRONY_OPTS="-classpath ${SYNCHRONY_JAR_PATH}:${DATABASE_DRIVER_PATH}"
SYNCHRONY_OPTS="${SYNCHRONY_OPTS} -Dsynchrony.service.url=${SYNCHRONY_URL}"
SYNCHRONY_OPTS="${SYNCHRONY_OPTS} -Dsynchrony.bind=${SERVER_IP}"
SYNCHRONY_OPTS="${SYNCHRONY_OPTS} ${CLUSTER_JOIN_PROPERTIES}"
SYNCHRONY_OPTS="${SYNCHRONY_OPTS} ${OPTIONAL_OVERRIDES}"
[ -z "${SYNCHRONY_DATABASE_URL}" ] && SYNCHRONY_OPTS="${SYNCHRONY_OPTS} -Dsynchrony.database.url=${DATABASE_URL}"
[ -z "${SYNCHRONY_DATABASE_USERNAME}" ] && SYNCHRONY_OPTS="${SYNCHRONY_OPTS} -Dsynchrony.database.username=${DATABASE_USER}"
[ -z "${SYNCHRONY_DATABASE_PASSWORD}" ] && SYNCHRONY_OPTS="${SYNCHRONY_OPTS} -Dsynchrony.database.password=${DATABASE_PASSWORD}"
if [[ ${@} == *"-fg"* ]]; then
${_RUNJAVA} ${SYNCHRONY_OPTS} synchrony.core sql
else
echo "To run Synchrony in the foreground, start the server with start-synchrony.sh -fg"
${_RUNJAVA} ${SYNCHRONY_OPTS} synchrony.core sql > /dev/null 2>&1 &
# Getting the PID of the process
PID=$!
echo $PID > "${SYNCHRONY_PID_FILE}"
echo "Starting Synchrony with PID ${PID}..."
echo "Binding: ${SERVER_IP}"
echo "overrides: ${OPTIONAL_OVERRIDES}"
echo "Please wait 30 seconds, then check this heartbeat URL in your browser for an 'OK': ${SYNCHRONY_URL}/heartbeat"
fi
3. Synchrony 서비스 유저 설정
$ vi <Synchrony Home Directory>/install_synchrony_service.sh
...
if [ -z "$SYNCHRONY_USER" ]; then
SERVICE_USER="<Service User Setting>"
else
SERVICE_USER=$SYNCHRONY_USER
fi
4. Synchrony 서비스 실행
$ ./<Synchrony Home Directory>/install_synchrony_service.sh
5. Synchrony 실행 에러 로그
$ ./<Synchrony Home Directory>/start-synchrony.sh -fg
6. Confluence 설정
$ vi <Confluence Install Directory>/bin/setenv.sh
...
# Synchrony service URL 추가
CATALINA_OPTS="-Dsynchrony.service.url=http://dcconfluence.twoseed.co.kr:7091/synchrony/v1 ${CATALINA_OPTS}"