빅데이터

Download Report

Transcript 빅데이터

Hadoop기반 빅데이터 실무과정
Zookeeper
빅데이터 최고의 커뮤니티
http://www.bicdata.com
Bigster 이사 김기선
SHARE THE KNOWLEDGE
CopyLeft © 2012 BIWORLD
목차
1. 개요
2. 설치
3. 동작 실습
4. Q&A
1 / 12
빅데이터 – http://www.bicdata.com
1. Zookeeper 개요
Zookeeper 소개
• Zookeeper는 고가용성 분산 코디네이션 시스템
• Zookeeper의 주요 용도
-
분산 락킹(distributed locking)
분산 시스템의 통합 설정 관리
네이밍 서비스
분산 시스템의 단일 스퀀스
Active/Stanby 관리, 클러스터의 멤버쉽 관리
- 분산 시스템 각 머신의 Life 상태 / 자원 모니터링
• Zookeeper 특징
* 고가용성 * 확장성 * 분산성
* 공유 설정
* 합의체 * 그룹 멤버쉽 * 리더 선출
* 네이밍/코디네이션
2 / 12
빅데이터 – http://www.bicdata.com
1. Zookeeper 개요
Zookeeper 구조
• Leader/Follower 구조
• 모든 서버에서 Read/Write 가능
• 리더가 받아서 다른 Follower에 전달
• 모든 Zookeeper 서버는 데이터의 복제본을 저장
• 리더는 시작시 리더선출 알고리즘에 의해서 자동 선정(리더 장애시에도)
• 이벤트는 리더로 전송되고 모든 서버에 저장될때 결과는 리턴됨
3 / 12
빅데이터 – http://www.bicdata.com
1. Zookeeper 개요
Zookeeper data model
• 인메모리 데이터베이스
- 내구성을 위해 변경내역은 로그로 저장
- 클라이언트는 파일시스템처럼 사용 가능
• 데이터는 계층화된 패스노드
- znode
- 디렉토리/파일 구조 아님
(데이터를 가지는 디렉토리)
- 데이터는 key-value로 저장
- 데이터는 최대 1M 제한
• 임시 노드
- 세션이 삭제되면 임시노드도 삭제
• 시퀀스 노드
• 고속 처리
- 초당 50,000번 변경
- 초당 200,000번 읽기
4 / 12
빅데이터 – http://www.bicdata.com
2. Zookeeper 설치
Zookeeper 설치
• 다운로드
- http://zookeeper.apache.org/
- wget http://apache.mirror.cdnetworks.com/zookeeper/zookeeper-3.3.5/zookeeper3.3.5.tar.gz 미러사이트에서 tarball 다운로드
• 압축풀기
- 설치를 원하는 곳에서 다운 받은 zookeeper-3.3.5.tar.gz를 푼다.
- tar –zxvf zookeeper-3.3.5.tar.gz
- ln –s zookeeper-3.3.5 zookeeper : 심볼릭 링크 설정
• 설정잡기
- ~/zookeeper/conf/zoo.cfg
5 / 12
빅데이터 – http://www.bicdata.com
2. Zookeeper 설치
Zookeeper
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/home/bdh/zookeeper/datadir
server.1=datanode1:2888:3888
server.2=datanode2:2888:3888
server.3=datanode3:2888:3888
# the port at which the clients will connect
clientPort=2181
6 / 12
빅데이터 – http://www.bicdata.com
2. Zookeeper 설치
Zookeeper 설치
• myid 설정
- vi myid
- zoo.cfg에서 설정했던 쿼룸(멤버서버의 숫자 아이디)에 맞게끔 myid를 설정
• 멤버 서버에 동일하게 zooker를 설치하고 myid를 설정
7 / 12
빅데이터 – http://www.bicdata.com
3. 동작실습
Zookeeper 서버 실행
• Zookeeper 기동
- ~/zookeeper/bin/zkServer.sh
- ~/zookeeper/bin/zookeeper.out
8 / 12
빅데이터 – http://www.bicdata.com
3. 동작실습
Zookeeper 서버 실행
•~/zookeeper/bin/zookeeper.out
9 / 12
빅데이터 – http://www.bicdata.com
3. 동작실습
Zookeeper 클라이언트 실행
• Zookeeper 서버에 접속
- ./zkCli.sh -server datanode1:2181
10 / 12
빅데이터 – http://www.bicdata.com
3. 동작실습
Zookeeper 동작 실습
• Zookeeper 동작 실습
help
[zk:datanode1:2181(CONNECTED)1] ls /
[zk:datanode1:2181(CONNECTED)1] create /zk_test my_data
[zk:datanode1:2181(CONNECTED)1] ls /
[zk:datanode1:2181(CONNECTED)1] get /zk_test
[zk:datanode1:2181(CONNECTED)1] set /zk_test junk
[zk:datanode1:2181(CONNECTED)1] get /zk_test
[zk:datanode1:2181(CONNECTED)1] delete /zk_test
[zk:datanode1:2181(CONNECTED)1] ls /
11 / 12
빅데이터 – http://www.bicdata.com
3. 동작실습
Q&A
12 / 12
빅데이터 – http://www.bicdata.com