1. 설치 파일 압축 해제 및 원하는 디렉토리로 이동
(..이하 생략)
2. 스크립트 생성
master
ㄴ connect_cli.sh
#java home
JAVA_HOME=/usr/local/bin/jdk-17
export JAVA_HOME
/sw/was/wildfly-26.1.2.Final/bin/jboss-cli.sh --connect --controller=192.168.56.107:7000
ㄴ add_user.sh
ㄴ 01_host_controller (start_master.sh, stop_master.sh, log_master.sh)
ㄴ 02_application_deploy (archived, exploded)
slave
ㄴ add_user.sh
ㄴ connect_cli.sh
ㄴ 01_host_controller (start_slave.sh, stop_slave.sh, log_slave.sh)
ㄴ 02_server
ㄴ 03_add_slave (reg-slave.cli, add_slave.sh)
1) master host controller 기동/정지 스크립트 생성
start_master.sh
#java home
export JAVA_HOME=/usr/local/bin/jdk-17
#---------------------------------------------------------------------------
#log_directory
LOG_DIR=/log/wildfly/master
#---------------------------------------------------------------------------
#server_properties
WILDFLY_HOME=/sw/was/wildfly-26.1.2.Final
DOMAIN_HOME=$WILDFLY_HOME/domain
SERVER_HOME=/log/wildfly/master
CONFIG_FILE=host-master.xml
HOST_NAME=master
IP_ADDRESS=192.168.56.107
#management console port
MANAGEMENT_PORT=7000
#process controller port
PC_PORT=7001
#---------------------------------------------------------------------------
#heap_memory
JAVA_OPTS="$JAVA_OPTS -Xms1024m -Xmx1024m"
export JAVA_OPTS
#---------------------------------------------------------------------------
#log_backup
LOG_TIME=$(date +"%Y%m%d_%H%M")
mv $LOG_DIR/$HOST_NAME.out ${LOG_DIR}/$HOST_NAME.out_${LOG_TIME}
#---------------------------------------------------------------------------
#master_host_start
nohup $WILDFLY_HOME/bin/domain.sh -Djboss.host.name=$HOST_NAME -Djboss.domain.base.dir=$DOMAIN_HOME -Djboss.domain.servers.dir=$SERVER_HOME --host-config=$CONFIG_FILE -Djboss.management.http.port=$MANAGEMENT_PORT -bmanagement=$IP_ADDRESS -b $IP_ADDRESS --pc-address=$IP_ADDRESS --pc-port=$PC_PORT>> $LOG_DIR/$HOST_NAME.out 2>&1 &
※ SERVER_HOME은 인스턴스의 서버 데이터 저장 공간임(웹로직으로 생각하면 /data /log 등등 있는 경로)
stop_master.sh
#java home
export JAVA_HOME=/usr/local/bin/jdk-17
#---------------------------------------------------------------------------
#server_properties
WILDFLY_HOME=/sw/was/wildfly-26.1.2.Final
IP_ADDRESS=192.168.56.107
MANAGEMENT_PORT=7000
HOST_NAME=master
#---------------------------------------------------------------------------
#master_host_shutdown
$WILDFLY_HOME/bin/jboss-cli.sh --connect --controller=$IP_ADDRESS:$MANAGEMENT_PORT --command=/host=$HOST_NAME:shutdown
log_master.sh
HOST_NAME=master
tail -100f /log/wildfly/master/$HOST_NAME.out
2) slave host controller 기동/정지 스크립트 생성
start_slave.sh
#java home
JAVA_HOME=/usr/local/bin/jdk-17
export JAVA_HOME
#---------------------------------------------------------------------------
#log_directory
LOG_DIR=/log/wildfly/slave
#---------------------------------------------------------------------------
#server_properties
WILDFLY_HOME=/sw/was/wildfly-26.1.2.Final
DOMAIN_HOME=$WILDFLY_HOME/domain
SERVER_HOME=/log/wildfly/slave
CONFIG_FILE=host-slave.xml
HOST_NAME=slave1
IP_ADDRESS=192.168.56.107
MANAGEMENT_PORT=7002
MASTER_IP=192.168.56.107
MASTER_PORT=7000
PC_PORT=7003
#---------------------------------------------------------------------------
#heap_memory
JAVA_OPTS="$JAVA_OPTS -Xms1024m -Xmx1024m"
export JAVA_OPTS
#---------------------------------------------------------------------------
#log_backup
LOG_TIME=$(date +"%Y%m%d_%H%M")
mv $LOG_DIR/$HOST_NAME.out ${LOG_DIR}/$HOST_NAME.out_${LOG_TIME}
#---------------------------------------------------------------------------
#slave_host_start
nohup $WILDFLY_HOME/bin/domain.sh -Djboss.host.name=$HOST_NAME -Djboss.domain.base.dir=$DOMAIN_HOME -Djboss.domain.servers.dir=$SERVER_HOME --host-config=$CONFIG_FILE -Djboss.domain.master.address=$MASTER_IP -Djboss.domain.master.port=$MASTER_PORT -Djboss.management.http.port=$MANAGEMENT_PORT -bmanagement=$IP_ADDRESS -b $IP_ADDRESS --pc-address=$IP_ADDRESS --pc-port=$PC_PORT --backup --cached-dc >> $LOG_DIR/$HOST_NAME.out 2>&1 &
※ MANAGEMENT_PORT와 PC_PORT는 slave host 내용으로 작성
master host가 7000, 7001 사용 중이므로, 7002, 7003으로 설정
stop_slave.sh
#java home
export JAVA_HOME=/usr/local/bin/jdk-17
#---------------------------------------------------------------------------
#server_properties
WILDFLY_HOME=/sw/was/wildfly-26.1.2.Final
IP_ADDRESS=192.168.56.107
MANAGEMENT_PORT=7002
HOST_NAME=slave1
#---------------------------------------------------------------------------
#slave_host_shutdown
$WILDFLY_HOME/bin/jboss-cli.sh --connect --controller=$IP_ADDRESS:$MANAGEMENT_PORT --command=/host=$HOST_NAME:shutdown
log_slave.sh
HOST_NAME=slave1
tail -100f /log/wildfly/slave/$HOST_NAME.out
3) 서버 인스턴스 기동/정지 스크립트 생성
3. management user 추가
add_user.sh 내용 수정 후 실행 (master host, slave host 계정 모두 생성)
#java home
JAVA_HOME=/usr/local/bin/jdk-17
export JAVA_HOME
WILDFLY_HOME=/sw/was/wildfly-26.1.2.Final
${WILDFLY_HOME}/bin/add-user.sh
master host 계정
(wildfly/wildfly)
slave host 계정
(slave1/slave1)
4. 바인딩 ip 주소 설정
jboss는 별도의 ip를 설정하지 않고 구동하면 바인딩 ip 주소가 자동으로 127.0.0.1로 바인딩 되어 외부 접속이 불가능하다.
외부 접속을 위해 host-master.xml 파일에 다음과 같이 설정
cd /sw/was/wildfly-26.1.2.Final/domain/configuration/
vi host-master.xml
5. master host 실행 후 관리 콘솔 접속 확인
./start_master.sh
start_master.sh에 설정한 ${서버ip}:${MANAGEMENT_PORT}로 접속
192.168.56.107:7000
'WAS > JBOSS_WILDFLY' 카테고리의 다른 글
7. [Domain] 서버 그룹 추가 및 삭제 (0) | 2023.08.31 |
---|---|
6. [Domain] 설치 - slave host (0) | 2023.08.23 |
4. [standalone] 패치 (0) | 2023.05.22 |
3. [standalone] 다른 장비에 이중화하기 (0) | 2023.05.22 |
2. [standalone] 인스턴스 추가 (0) | 2023.05.22 |