공유할 서비스 선택

TECH


TECH

Middleware (Apache, Tomcat) 로드밸런싱 구성

페이지 정보

작성자 미들웨어 아이디로 검색 전체게시물 댓글 0건 조회 9,472회 좋아요 2회 작성일 20-04-07 15:15

본문

 

안녕하세요.  

첫 시간으로 미들웨어 아키텍처 설계를 할때 가장 많이 사용되는 3-TIER 방식에 대해 설명드리고, 

3-tire을 설계할때 필요한 WEB, WAS 이중화 방식에 대해 정의해보겠습니다.

 

"미들웨어(middleware)는 응용 소프트웨어가 운영 체제로부터 제공받는 서비스 이외에 추가적으로 이용할 수 있는 서비스를 제공하는 컴퓨터 소프트웨어이다"

https://ko.wikipedia.org/wiki/%EB%AF%B8%EB%93%A4%EC%9B%A8%EC%96%B4 

 

 

1. 3-Tier 이란?

 

  • Client: 사용자
  • Web Server: Client의 요청을 처리하는 첫 관문이며, Static 이미지나, was로 전달해주는 역활을 주로 합니다. 
  • WAS: Web Application Server 애플리케이션을 처리합니다.
  • DB: 데이터베이스

 

bae2a4e797327eb83810fa1194c91b12_1586237826_3893.png

 

 

 

 

2. 미들웨어의 종류

미들웨어의 종류는 아주 많습니다.

여기서 미들웨어의 역사 공부를 하고자 하는 것이 아니므로 오픈소스로 자주 사용하는 것들만 나열하겠습니다.

요즘은 Apache 보다도 Nginx 를 Proxy활용용도로 더 자주 사용하는 추세입니다.

 

  • WEB : Apache, Nginx
  • WAS : Tomcat, JBoss-eap, Wildfly, SpringBoot

 

 

3. 미들웨어 이중화란?

미들웨어를 구성할때 리스크를 줄이고 서비스의 안전성, 확대성, 고성능을 위해서 일반적으로 이중화 작업을 진행합니다.

위에 명시해드린 3-tier 방식에서 (WEB, WAS) 이중화를 진행하는 방식은 이중화 구성에 대해 가장 간편한 방법 입니다

 

 

4. Apache(1대) & Tomcat(2대) 로드밸런싱 설정

apache 다운로드 : https://httpd.apache.org/download.cgi

apache 메뉴얼 : https://httpd.apache.org/docs/2.4/

 

 

샘플) Apache 1대 & Tomcat 2대

- 아래 샘플은 Apache 1대에 Tomcat 2대를 연결한 구성입니다.

- 이것 또한 미들웨어 이중화에 해당하는 구조이나 Tomcat & Tomcat 간 Cluster 구성설정은 추가되지 않았습니다.

-  Apache (WEB) 서버의 로드밸런서라 보시면 됩니다.

 

(1) <APACHE_HOME>/conf/httpd.conf
# Include mod_jk's specific configuration file
Include conf/mod-jk.conf
파일의 맨 끝에 위와 같이 mod-jk.conf 를 include 하는 것을 추가


(2) <APACHE_HOME>/conf/mod-jk.conf
# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile conf/workers.properties

# Where to put jk logs
JkLogFile logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel info

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"

# Mount your applications
JkMount /test-jboss/* loadbalancer    <-- 안넣어도 무관

# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties

# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm

# Add jkstatus for managing runtime data
<Location /jkstatus/>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
웹 어플리케이션의 context-root 가 /text-jboss 이기 때문에 JkMount 에 설정하였습니다.


(3) <APACHE_HOME>/conf/uriworkermap.properties
# Simple worker configuration file

# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer
/=loadbalancer
/*=loadbalancer
/*=loadbalancer   웹 어플리케이션의 context-root 로 마운트 포인트를 설정합니다.


(4) <APACHE_HOME>/conf/workers.properties
# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,jkstatus

# Define Node1
worker.cluster1.port=8009
worker.cluster1.host=10.10.10.1
worker.cluster1.type=ajp13
worker.cluster1.cachesize=10

# Define Node2
worker.cluster2.port=8009
worker.cluster2.host=10.10.10.2
worker.cluster2.type=ajp13
worker.cluster2.cachesize=10

# Load-balancing 
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=cluster1,cluster2
worker.loadbalancer.sticky_session=1

# Status worker for managing load balancer
worker.jkstatus.type=status
인스턴스에 해당하는 AJP 1.3 포트를 설정합니다.

(5) apache 재기동 합니다.

 

 

질문 있으시면 댓글로 달아주세요.

답글 달아드리겠습니다.

 

첨부파일

댓글목록

등록된 댓글이 없습니다.

TECH 목록
번호 제목 작성자 작성일 조회수
198 OS OSworker 아이디로 검색 전체게시물 03-24 53
RHEL7 to RHEL8 leapp으로 마이그레이션 하는 방법에 대해~

카테고리 : OS

53 0
작성자 : OSworker 24/03/24
197 Middleware 미들웨어 아이디로 검색 전체게시물 03-21 41
(오픈소스 활용-27) Redis Cache 란? 활용방법과 다운로드

카테고리 : Middleware

41 0
작성자 : 미들웨어 24/03/21
196 OS OSworker 아이디로 검색 전체게시물 03-17 68
Convert2RHEL를 사용하여 CentOS 7.9 에서 RHEL7.9로 전환해보겠습니다.

카테고리 : OS

68 0
작성자 : OSworker 24/03/17
195 Middleware 미들웨어 아이디로 검색 전체게시물 03-07 84
(weblogic 활용) WebLogic Kubernetes Toolkit-UI (무료) 설치 및 구성가이드

카테고리 : Middleware

84 0
작성자 : 미들웨어 24/03/07
194 OS OSworker 아이디로 검색 전체게시물 02-28 156
RHEL8부터는 네트워크 본딩을 구성하려면 nmcli 유틸리티를 사용해야 합니다. 레드햇 권고입니다.

카테고리 : OS

156 0
작성자 : OSworker 24/02/28
193 Middleware 미들웨어 아이디로 검색 전체게시물 02-20 201
(AI-2) Chat-GPT 4All - 허깅페이스 & LLM 국내 인기순위 (Open Ko-LLM LeaderBoard)

카테고리 : Middleware

201 0
작성자 : 미들웨어 24/02/20
192 OS OSworker 아이디로 검색 전체게시물 02-19 261
[질문] free 메모리에서 Used가 너무 높게 나오는데, ps 명령어에는 사용율이 없습니다.

카테고리 : OS

261 0
작성자 : OSworker 24/02/19
191 Middleware 미들웨어 아이디로 검색 전체게시물 02-06 259
(AI-1) Chat-GPT 4All - PC 설치 방법

카테고리 : Middleware

259 0
작성자 : 미들웨어 24/02/06
190 OS OSworker 아이디로 검색 전체게시물 02-05 332
1월31일에 발표된 보안취약점 CVE-2024-21626에 대해 알아보겠습니다.

카테고리 : OS

332 0
작성자 : OSworker 24/02/05
189 OS OSworker 아이디로 검색 전체게시물 01-31 315
OS 백업 아직도 3rd part 사용하시나요? 이제는 OS 에 포함된 ReaR 사용해보세요~!

카테고리 : OS

315 0
작성자 : OSworker 24/01/31
Total 198건
게시물 검색

주식회사 클럭스| 대표 : 이찬호| 사업자등록번호 : 107-87-27655
주소 : 서울특별시 영등포구 국회대로 800, 여의도파라곤
E-mail : sales@chlux.co.kr
Copyright © 클럭스 www.chlux.co.kr All rights reserved.
상단으로Top