공유할 서비스 선택

TECH


TECH

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

페이지 정보

작성자 미들웨어 아이디로 검색 전체게시물 댓글 0건 조회 9,475회 좋아요 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 목록
번호 제목 작성자 작성일 조회수
94 Middleware 미들웨어 아이디로 검색 전체게시물 10-23 654
(오픈소스 활용-22) 리눅스에 Jenkins-2.4 설치 가이드

카테고리 : Middleware

654 0
작성자 : 미들웨어 23/10/23
93 Middleware 미들웨어 아이디로 검색 전체게시물 10-11 370
(MSA 개발-3) MSA 파일(JAVA)분석

카테고리 : Middleware

370 0
작성자 : 미들웨어 23/10/11
92 Middleware 미들웨어 아이디로 검색 전체게시물 09-22 371
(MSA 개발-2) Oracle DB & SpringBoot MSA 응용 프로그램 테스트

카테고리 : Middleware

371 0
작성자 : 미들웨어 23/09/22
91 Middleware 미들웨어 아이디로 검색 전체게시물 09-11 663
(MSA 개발-1) Oracle DB를 사용한 SpringBoot 마이크로서비스

카테고리 : Middleware

663 0
작성자 : 미들웨어 23/09/11
90 Middleware 미들웨어 아이디로 검색 전체게시물 08-21 501
(MSA 개발 환경 구성-2) Oracle DB (Docker)& SQLcl 구성

카테고리 : Middleware

501 0
작성자 : 미들웨어 23/08/21
89 Middleware 미들웨어 아이디로 검색 전체게시물 08-09 2055
(MSA 개발 환경 구성-1) Maven & VScode & RancherDesktop설치

카테고리 : Middleware

2,055 0
작성자 : 미들웨어 23/08/09
88 Middleware 미들웨어 아이디로 검색 전체게시물 07-24 787
(Oracle Cloud) OCI 자격증 기출문제 "OCI Architect Associate"

카테고리 : Middleware

787 2
작성자 : 미들웨어 23/07/24
87 Middleware 미들웨어 아이디로 검색 전체게시물 07-07 616
클라우드 네이티브란 무엇인가?

카테고리 : Middleware

616 0
작성자 : 미들웨어 23/07/07
86 Middleware 미들웨어 아이디로 검색 전체게시물 06-23 623
(Oracle Cloud) OCI 자격증 기출문제 "OCI Foundation" -2

카테고리 : Middleware

623 0
작성자 : 미들웨어 23/06/23
85 Middleware 미들웨어 아이디로 검색 전체게시물 06-12 892
(Oracle Cloud) OCI 자격증 접수 및 문제유형 "OCI Foundation" -1

카테고리 : Middleware

892 0
작성자 : 미들웨어 23/06/12
Total 104건
게시물 검색

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