Background Image
조회 수 3918 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
CUBRID SELECT Query Load Balance


▶  CUBRID SELECT Query Load Balance 튜토리얼 환경 :
- VMware Work Station 11
- VM Version 10
- OS : Linux Centos 6.7 64bit
- CUBRID Version : 9.3.6.0002
- CUBRID JDBC Driver Version : 9.3.6.0002 

▶  CUBRID SELECT Query Load Balance 목적 : 
     - 조회 질의(SELECT) 분산을 통해 Broker Server와 Data Bases Server 리소스 부하를 줄일 수 있다.


jdbcload1.png
(그림 1-1. CUBRID Load Balance 미사용 다중화 구성)



jdbcload2.png
(그림 1-2. CUBRID Load Balance 사용 다중화 구성)


▶ 튜토리얼 구성 시나리오
- Broker Server_1
- Host Name : BRO_SV_1
- IP : 192.168.0.111
- Broker Port : 33000

- Broker Server_2
- Host Name : BRO_SV_1
- IP : 192.168.0.111
- Broker Port : 33000

- DataBase Server_1
- Host Name : DB_SV_1
- IP : 192.168.0.221

- DataBase Server_2
- Host Name : DB_SV_1
- IP : 192.168.0.222

- Data Bases Info
- DB Name : demodb
- DB User : demouser
- Query Type : SELECT



JDBC Setting

▶ JDBC Driver Configuration
- JDBC 사용 옵션
     - loadBalance

- Load Balance 사용을 위한 URL

"jdbc:cubrid:192.168.0.111:33000:demodb:demouser::?althosts=192.168.0.112:33000&loadBalance=true"

- 해당 URL은 앞의 192.168.0.111과 192.168.0.112을 랜덤한 순서로 연결한다.


BROKER Setting 


▶ Broker Server 1 Configuration

- Fail-Over 발생 후 Fail-Back이 되게 되면 기존의 연결 된 CAS들은 JDBC LoadBalance 와 무관하게 Active로만 연결 되게 된다. 
- 이 부분을 cubrid_broker.conf 값의 RECONNECT_TIME=10s를 통해 자신의 databases.txt의 우선 순위가 되는 DataBases로 다시 연결 하는 Broker 옵션을 사용한다.

$ cat $CUBRID/databases/databases.txt
#db-name        vol-path                db-host         log-path                lob-base-path
demodb          /home/cubrid/DB/demodb  DB_SV_1:DB_SV_2    /home/cubrid/DB/demodb  file:/home/cubrid/DB/demodb/lob

$ cat $CUBRID/conf/cubrid_broker.conf

[%BROKER1]
RECONNECT_TIME=10s

$ cat /etc/hosts
192.168.0.111     BRO_SV_1
192.168.0.112     BRO_SV_2

192.168.0.221     DB_SV_1
192.168.0.222     DB_SV_2

# cat /etc/sysconfig/iptables

-A INPUT -p tcp --dport 33000 -j ACCEPT


▶ Broker Server 2 Configuration

- Fail-Over 발생 후 Fail-Back이 되게 되면 기존의 연결 된 CAS들은 JDBC LoadBalance 와 무관하게 Active로만 연결 되게 된다. 
- 이 부분을 cubrid_broker.conf 값의 RECONNECT_TIME=1s를 통해 자신의 databases.txt의 우선 순위가 되는 DataBases로 다시 연결 하는 Broker 옵션을 사용한다.

$ cat $CUBRID/databases/databases.txt
#db-name        vol-path                db-host         log-path                lob-base-path
demodb          /home/cubrid/DB/demodb  DB_SV_2:DB_SV_1    /home/cubrid/DB/demodb  file:/home/cubrid/DB/demodb/lob

$ cat $CUBRID/conf/cubrid_broker.conf

[%BROKER1]
RECONNECT_TIME=10s

$ cat /etc/hosts
192.168.0.111     BRO_SV_1
192.168.0.112     BRO_SV_2

192.168.0.221     DB_SV_1
192.168.0.222     DB_SV_2

# cat /etc/sysconfig/iptables

-A INPUT -p tcp --dport 33000 -j ACCEPT



DB Setting

▶ Data Base Server 1 Configuration

DB_SV_1 Master 모드

$ cat /etc/hosts
192.168.0.111     BRO_SV_1
192.168.0.112     BRO_SV_2

192.168.0.221     DB_SV_1
192.168.0.222     DB_SV_2

# cat /etc/sysconfig/iptables

-A INPUT -p tcp --dport 1523 -j ACCEPT
-A INPUT -p udp --dport 59901 -j ACCEPT


▶ Data Base Server 2 Configuration

DB_SV_2 Slave 모드

$ cat /etc/hosts
192.168.0.111     BRO_SV_1
192.168.0.112     BRO_SV_2

192.168.0.221     DB_SV_1
192.168.0.222     DB_SV_2

# cat /etc/sysconfig/iptables

-A INPUT -p tcp --dport 1523 -j ACCEPT
-A INPUT -p udp --dport 59901 -j ACCEPT




마치며

▶ CUBRID 다중화 구성

- CUBRID는 Broker와 Database Server 같은 시스템(OS)에 둘 수도 있으며, 별도의 시스템(OS)으로 분리도 가능하다.
- 이러한 점에서 CUBRID로 연결되는 Driver와  CUBRID의 Broker, Database의 연결 관계를 이해하면 다양한 다중화 구성이 가능하다.

▶ CUBRID 참고 문헌
     - CUBRID 시스템 구조
  (http://www.cubrid.org/manual/ko/9.3.0/intro.html#id1)

     -JDBC 연결 설정
          (http://www.cubrid.org/manual/ko/9.3.0/api/jdbc.html#jdbc-connection-conf)

     - Broker 접속 관련 파라미터
  (http://www.cubrid.org/manual/ko/9.3.0/admin/config.html#cubrid-broker-conf)



감사합니다.

  1. <주의> 생성한 DB볼륨을 절대! 삭제하지 말자

    Date2019.09.30 CategoryLinux By큐브리드_김주현 Views1558
    Read More
  2. 리눅스에서 top 명령어를 통한 CPU 점유율 확인 및 측정하기

    Date2017.06.02 CategoryLinux By정훈 Views79918
    Read More
  3. 리소스를 제한(limits.conf) 하여 DB서버를 관리하자

    Date2015.12.31 CategoryLinux By주현 Views26553
    Read More
  4. 가상머신 환경에서 리눅스 및 큐브리드 설치 가이드

    Date2015.07.14 CategoryLinux By이경오 Views13367
    Read More
  5. CUBRID Linux 부팅시 자동시작 서비스 설정 방법

    Date2013.09.16 CategoryLinux By정만영 Views25454
    Read More
  6. CUBRID DB와 Broker 분리방안

    Date2010.04.28 CategoryLinux By정만영 Views28411
    Read More
  7. CUBRID 복제 설계 가이드

    Date2010.03.03 CategoryLinux By정만영 Views25138
    Read More
  8. CUBRID 사용 포트와 iptables(방화벽) 설정

    Date2010.03.01 CategoryLinux By정만영 Views38341
    Read More
  9. CUBRID2008R1.x to 2.0 마이그레이션 가이드 (32bit 기준)

    Date2009.08.17 CategoryLinux By정만영 Views27200
    Read More
  10. CUBRID Tutorial (Unix/Linux)

    Date2009.08.17 CategoryLinux By정만영 Views27884
    Read More
  11. HP-UX에서 CUBRID 사용을 위한 kernel 설정값 조정

    Date2009.04.01 CategoryLinux Byadmin Views54135
    Read More
  12. cron을 이용한 백업 자동화

    Date2009.04.01 CategoryLinux Byadmin Views33118
    Read More
  13. CUBRID서비스 시스템 재구동시 자동 구동/종료 방법

    Date2009.04.01 CategoryLinux Byadmin Views29799
    Read More
  14. 복제 따라하기

    Date2008.11.21 CategoryLinux Byadmin Views29094
    Read More
  15. CUBRID 2008 사용법

    Date2008.11.21 CategoryLinux Byadmin Views36761
    Read More
Board Pagination Prev 1 Next
/ 1

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales