공유할 서비스 선택

TECH


TECH

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

페이지 정보

작성자 미들웨어 아이디로 검색 전체게시물 댓글 0건 조회 9,477회 좋아요 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 목록
번호 제목 작성자 작성일 조회수
148 Middleware 미들웨어 아이디로 검색 전체게시물 04-24 743
(오픈소스 활용-18) VSCODE 설치 및 GIT 활용 연동 가이드

카테고리 : Middleware

743 0
작성자 : 미들웨어 23/04/24
147 Middleware 미들웨어 아이디로 검색 전체게시물 04-05 1049
(오픈소스 활용-17) 로컬 및 URL 호출 테스트 옵션 (curl, ab 옵션으로 부하주기)

카테고리 : Middleware

1,049 0
작성자 : 미들웨어 23/04/05
146 Middleware 미들웨어 아이디로 검색 전체게시물 03-20 573
(오픈소스 활용-16) Jstack을 활용하여 CPU급등한 프로세스 파일로 떨구기

카테고리 : Middleware

573 0
작성자 : 미들웨어 23/03/20
145 OS leechanho 아이디로 검색 전체게시물 03-15 1944
[쉘스크립트] 리눅스 시스템 정보수집 스크립트

카테고리 : OS

1,944 1
작성자 : leechanho 23/03/15
144 Middleware 미들웨어 아이디로 검색 전체게시물 03-08 1017
(Monitoring) Jennifer & Slack 연동 구성방법 (이벤트 발생 확인)

카테고리 : Middleware

1,017 0
작성자 : 미들웨어 23/03/08
143 Middleware 미들웨어 아이디로 검색 전체게시물 02-20 940
Coherence란 무엇인가?

카테고리 : Middleware

940 0
작성자 : 미들웨어 23/02/20
142 Middleware 미들웨어 아이디로 검색 전체게시물 02-08 1483
TP-monitor 란 무엇인가?

카테고리 : Middleware

1,483 0
작성자 : 미들웨어 23/02/08
141 Middleware 미들웨어 아이디로 검색 전체게시물 01-25 475
(weblogic 활용) Weblogic을 마켓에서 구매후 클릭으로 설치 -2

카테고리 : Middleware

475 0
작성자 : 미들웨어 23/01/25
140 Middleware 미들웨어 아이디로 검색 전체게시물 01-12 581
(weblogic 활용) Weblogic을 마켓에서 구매후 클릭으로 설치 -1

카테고리 : Middleware

581 0
작성자 : 미들웨어 23/01/12
139 Middleware 미들웨어 아이디로 검색 전체게시물 12-21 934
(오픈소스 활용-15) DB연동 테스트 샘플jsp (DBtest.jsp)

카테고리 : Middleware

934 0
작성자 : 미들웨어 22/12/21
Total 198건
게시물 검색

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