공유할 서비스 선택

TECH


TECH

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

페이지 정보

작성자 미들웨어 아이디로 검색 전체게시물 댓글 0건 조회 9,847회 좋아요 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 목록
번호 제목 작성자 작성일 조회수
7 Middleware 미들웨어 아이디로 검색 전체게시물 05-10 8539
(Nginx-1) Nginx 설치 및 컴파일 방법

카테고리 : Middleware

8,539 0
작성자 : 미들웨어 20/05/10
6 Middleware 미들웨어 아이디로 검색 전체게시물 04-21 8845
(JBoss & Wildfly) 기동, 다운 스크립트 생성 방법 (standalone.sh, domain.sh)

카테고리 : Middleware

8,845 0
작성자 : 미들웨어 20/04/21
5 Middleware 미들웨어 아이디로 검색 전체게시물 04-21 10952
(JBoss & Wildfly) standalone-ha.xml 를 사용한 Cluster 구성 방법

카테고리 : Middleware

10,952 0
작성자 : 미들웨어 20/04/21
4 Middleware 미들웨어 아이디로 검색 전체게시물 04-07 3510
(Tomcat) 튜닝가이드 공개

카테고리 : Middleware

3,510 0
작성자 : 미들웨어 20/04/07
3 Middleware 미들웨어 아이디로 검색 전체게시물 04-07 6145
(Apache) 튜닝 가이드 공개

카테고리 : Middleware

6,145 0
작성자 : 미들웨어 20/04/07
열람중 Middleware 미들웨어 아이디로 검색 전체게시물 04-07 9848
열람중
(Apache, Tomcat) 로드밸런싱 구성

카테고리 : Middleware

9,848 0
작성자 : 미들웨어 20/04/07
1 Middleware partner 아이디로 검색 전체게시물 11-19 12934
[TOMCAT] log 관리

카테고리 : Middleware

12,934 0
작성자 : partner 18/11/19
Total 107건
게시물 검색

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