1. 일단 EC2 를 만들었다.
sudo apt-get update
mkdir -p /home/ubuntu/app/pinpoint # /home/ubuntu/app/pinpoint
mkdir -p /home/ubuntu/app/pinpoint/hbase/data
mkdir -p /home/ubuntu/app/pinpoint/zookeeper
2. 일단 HBase를 설치한다
- https://cyberx.tistory.com/164
- Apache에서 만든 하둡 기반의 분산 관리형 DB
wget http://archive.apache.org/dist/hbase/1.2.7/hbase-1.2.7-bin.tar.gz
tar -zxvf hbase-1.2.7-bin.tar.gz
오케이 일단 압축 해제 되었고..
cd hbase-1.2.7/conf
설정 파일을 수정해보자
vi hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
hbase.rootdir
file:///home/ubuntu/app/pinpoint/hbase/data
hbase.zookeeper.property.dataDir
/home/bkjeon/app/pinpoint/zookeeper
<configuration>
</configuration>
3. 이제 JDK 8을 설치한다
sudo apt install openjdk-8-jdk
환경변수 JAVA_HOME
을 추가해주자
which javac
# 결과 : /usr/bin/javac
readlink -f /usr/bin/javac
# 결과 : /usr/lib/jvm/java-8-openjdk-amd64
# /etc/profile 하단에 결과 추가
vi /etc/profile
#### 파일 안 ####
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# 이제 ssh를 나갔다 오면 된다
- 환경 변수 : 해당 OS 위에서 돌아가는 프로세스들이 참고하는 일종의 전역변수
- javac : Java Compiler,
.java
를 자바 가상머신이 인식할 수 있는.class
로 변환시켜주는 명령어이다.
4. HBase를 실행시키자
# /home/ubuntu/app/hbase-1.2.7/bin
./start-hbase.sh
# starting master, logging to /home/ubuntu/app/hbase-1.2.7/bin/../logs/hbase-ubuntu-master-ip-172-30-0-200.out
# OpenJDK 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
# OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
ps aux | grep hbase # hbase process가 보인다
- JDK Heap 관련 설정 저거 JDK7 설정인데 나중에 JDK8 설정으로 바꿔줘야 될 것 같다 ^^...
# /home/ubuntu/app/hbase-1.2.7/bin
./hbase shell
> list
./hbase shell
을 사용하면 HBase의 shell로 들어갈 수 있고, list
명령어로 테이블 목록을 확인할 수 있다.
5. 이제 HBase에 Pinpoint가 사용하는 Table을 만들어 주어야 한다
https://github.com/pinpoint-apm/pinpoint/blob/master/hbase/scripts/hbase-create.hbase
에 있는 스크립트를 vim에 복붙한다
mkdir script/
# /home/ubuntu/app/hbase-1.2.7/script
vi hbase-create.hbase
# 테이블 생성
/home/ubuntu/app/hbase-1.2.7/bin/hbase shell ./hbase-create.hbase
6. Collector와 Web을 설치하고 실행하자
# /home/ubuntu/app
# Collector 설치
wget https://github.com/pinpoint-apm/pinpoint/releases/download/v2.2.2/pinpoint-collector-boot-2.2.2.jar
# Web 설치
wget https://github.com/pinpoint-apm/pinpoint/releases/download/v2.2.2/pinpoint-web-boot-2.2.2.jar
java -jar -Dpinpoint.zookeeper.address=localhost pinpoint-collector-boot-2.2.2.jar &
java -jar -Dpinpoint.zookeeper.address=localhost pinpoint-web-boot-2.2.2.jar &
7. Agent를 달아주자
wget https://github.com/pinpoint-apm/pinpoint/releases/download/v2.2.2/pinpoint-agent-2.2.2.tar.gz
tar -zxvf pinpoint-agent-2.2.2.tar.gz
# vi pinpoint-agent-2.2.0/pinpoint-root.config
profiler.transport.grpc.collector.ip=192.168.0.207
# Agent와 함께 jar을 실행하는 방법
$ java -jar
-javaagent:pinpoint-agent-2.2.0/pinpoint-bootstrap-2.2.0.jar \
-Dpinpoint.agentId=base-api \
-Dpinpoint.applicationName=API-EXAMPLE \
-Dpinpoint.config=pinpoint-agent-2.2.0/pinpoint-root.config \
/home/bkjeon/app/base-api-0.0.0.jar &
-javaagent:
: agent jar 경로 (절대 경로 가능)-Dpinpoint.agentId
: 서버 고유 지정 (hostname이 들어가면 좋을듯)-Dpinpoint.applicationName
: 어플리케이션 이름-Dpinpoint.config
: config 경로 (절대 경로 가능)
8. 알람도 있다고 한다
추후 Pinpoint 알람에 대해 조사할때 여길 참고하면 좋을 것 같다.
https://github.com/pinpoint-apm/pinpoint/blob/master/doc/alarm.md
예상 보다 쉽게 설치 완료했다. 사양은 t3a.large 사용
정말 한가할 때 나오는 TPM 600~700 / 재태크 앱 특성상 좋은 미션이 있으면 트래픽이 몰려서 TPM 9,000 ~ 10,000 사이로도 나온다 (TPS로 치면 TPS 150~167)
실시간으로 CPU, Memory, JVM, DBCP 까지 모니터링 할 수 있다.. 정말 갓갓 핀포인트..
한 2~3주 전에 도입했는데, 도입하고 난 후 동료분들의 피드백 : 이렇게 좋은게 있는 줄 알았다면 진작 셋팅할 것 그랬다....
'개발 공부 기록하기 > 03. AWS & Infra' 카테고리의 다른 글
AWS Auto Scaling에 로드 밸런서 붙이기 (0) | 2020.11.07 |
---|---|
AWS 시작 템플릿 (Launch Template) 옵션 하나하나 살펴보기 (0) | 2020.10.21 |
AWS Auto Scaling 구축하기 (0) | 2020.10.15 |
ulimit에 대해 알아보자 (0) | 2020.10.05 |
패커 (Packer) 시작하기 (4) | 2020.10.01 |