http://khaidoan.wikidot.com/amazon-ses
커스텀한 소스코드는 개인 VCS저장소에 보관 중
전체 글
- AWS SES로 이메일보내기(첨부파일 포함) 참고 2017.11.29
- pinpoint 설치 방법 메모 2017.11.16
- JSP파일에서 JSTL의 html변경 후 남은 whitespace를 없애는 프로그램 Java 버전 2017.07.12
- HTTPS를 통해 AWS CodeCommit 저장소(repository)에 인증하는 방법 2017.06.19
- 웹에서 ERD 그릴수 있는 툴(무료) 2017.05.25
- CentOS 7에 Mysql 5.7 설치 2017.05.17 1
- nGrinder 설치방법 정리 - 3.4Ver 2017.05.10
- mongo 3.4 설치방법 정리 2017.05.10
AWS SES로 이메일보내기(첨부파일 포함) 참고
2017. 11. 29. 11:43
pinpoint 설치 방법 메모
2017. 11. 16. 11:40
171009 기준 1.7.0 스냅샷버전
* 주기적으로 최신버전을 설치 후 글을 추가하고 있습니다. 블로그에서 pinpoint로 검색해서 가능하면 최신 버전을 설치하세요
유저홈/apps 디렉토리를 기준으로 설치 함
#디렉토리 생성
mkdir ~/apps && cd ~apps
#master(최신) 버전 다운로드 후 압축 해제
wget 'https://github.com/naver/pinpoint/archive/master.zip' && unzip master.zip && rm master.zip
# 심볼링 링크 처리
ln -s pinpoint-master pinpoint
#인스톨(JAVA 6,7,8 필요)
cd ~/apps/pinpoint && ./mvnw install -Dmaven.test.skip=true
#JAVA설치
#jdk 8설치
#jdk 7설치
#jdk6설치
cd ~/apps
wget 'http://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin?AuthParam=1508680311_c1e13b7b6484284c9598fd1a0db61fa3';; -O jdk-6u45-linux-x64.bin
chmod 755 jdk-6u45-linux-x64.bin && ./jdk-6u45-linux-x64.bin && rm jdk-6u45-linux-x64.bin
#환경변수 등록
vi ~/.bashrc 후에
export JAVA_HOME=~/apps/jdk
export JAVA_8_HOME=~/apps/jdk_8
export JAVA_6_HOME=~/apps/jdk_6
export JAVA_7_HOME=~/apps/jdk_7
export PATH=$JAVA_HOME/bin:$PATH
#참고 : JAVA DNS TTL Modify
echo 'networkaddress.cache.ttl=60' >> ~/apps/jdk/jre/lib/security/java.security
#참고 : OS 디스크외 AWS EBS를 추가로 마운트해서 데이터를 저장한다면 pinpoint data디렉토리 변경(/data에 EBS 마운트)
cd ~/apps/pinpoint/quickstart && ln -s /data/pinpoint data
sudo su
mkdir /data/pinpoint && chown 유저계정:유저계정 /data/pinpoint
Hbase 설치 및 시작
-- HBase 저장기간을 줄임(1일=86400초로 줄이는데 상황에 따라서 적당한 수치로 조정)
vi ./quickstart/conf/hbase/init-hbase.txt 후 아래 입력
:%s/5184000/86400/g
-- Hbase 다운로드 및 시작
quickstart/bin/start-hbase.sh
-- Hbase 테이블 초기화
quickstart/bin/init-hbase.sh
Pinpoint 데몬들 설정 후 시작
-- 컬렉터로그 레벨을 조정해서 적게 남기도록 함
vi ./quickstart/collector/src/main/resources/log4j.xml
:%s/DEBUG/INFO/g
:%s/TRACE/INFO/g
-- pinpoint 웹의 로그레벨 조정
vi ./quickstart/web/src/main/resources/log4j.xml
:%s/DEBUG/INFO/g
-- 컬렉터(데이터 수집 프로세스) 시작
quickstart/bin/start-collector.sh
-- 웹 UI 시작
quickstart/bin/start-web.sh
agent 수정(해당 agent가 실제 어플리케이션 시작시 사용됨)
agent 홈 경로 : ~/apps/pinpoint/agent/target/pinpoint-agent-버전
cd ~/apps/pinpoint/agent/target/pinpoint-agent-버전
-- agent 로그 조정( 미 조정시 DEBUG레벨로 로그가 남아서 대상 프로그램의 성능 하향이 발생)
vi lib/log4j.xml 후 아래 명령 수행(로그레벨 DEBUG를 INFO로 조정)
:%s/DEBUG/INFO/g
아래내용은 삭제
<appender-ref ref="console" />
-- Collector server의 IP 및 포트 수정
vi ./quickstart/agent/src/main/resources/pinpoint.config
cd ~/apps/pinpoint/agent/target/pinpoint-agent-1.7.0-SNAPSHOT && vi pinpoint.config
-- 어플리케이션 서버로 복사를 위해서 압축해둠
ex) tar -czf pinpoint-agent-1.7.0-SNAPSHOT_171023.tar.gz pinpoint-agent-1.7.0-SNAPSHOT
이후 APM으로 모니터링하고 싶은 서버에 Agent 복사 후 프로세스 실행시 agent 사용하도록 셋팅
- 방법은 정리 예정이며 필요시 구글 검색하세요
'JAVA > 툴 및 팁' 카테고리의 다른 글
| 오라클 사이트에서 JDK8 다운로드해서 리눅스 설치용 wget 명령어 생성 방법 (0) | 2019.05.06 |
|---|---|
| nexus 설치 및 셋팅 (0) | 2019.03.22 |
| pinpoint 설치 방법- 1.8.1 버전 (0) | 2018.12.21 |
| JAVA 웹 개발환경 셋팅 - STS(Eclipse) (0) | 2016.12.18 |
| Eclipse / STS 에서 특정 코드블럭에 formatter 미 적용하는 방법 (0) | 2016.07.04 |
JSP파일에서 JSTL의 html변경 후 남은 whitespace를 없애는 프로그램 Java 버전
2017. 7. 12. 00:53
import java.io.File;
import java.util.Collection;
import java.util.List;
import org.apache.commons.io.FileUtils;
/**
* 특정 디렉토리 하위의, 특정 확장자 파일에 대한 처리
* - 2번째 줄에 trimDirectiveWhitespaces 처리를 위한 내용 추가
*
* @author 엄승하
*/
public class JspAddTrimWhitespaceTag {
public static void main(String[] args) throws Exception {
//jsp파일을 찾기 시작할 디렉토리
String startDirPath = "파일을 찾기 시작할 디렉토리 경로";
//파일 확장자 지정
String[] ext = {"jsp"};
//해당 파일들을 찾아서 컬렉션에 담음(recursive)
Collection<File> jspFileList = FileUtils.listFiles(new File(startDirPath), ext, true);
System.out.println(String.format("총 %s개", jspFileList.size()));
String addStr = "<%@ page trimDirectiveWhitespaces=\"true\" %>"; //파일에 추가할 내용 : JSTL의 html변경 후 남은 whitespace를 없애는 처리
for (File jspFile : jspFileList) {
//System.out.println(file.getAbsolutePath());
List<String> fileContents = FileUtils.readLines(jspFile, "UTF-8");
fileContents.add(1, addStr); //2번째줄에 추가할 문자를 컨텐츠 내용에 추가
FileUtils.writeLines(jspFile, fileContents); //해당 파일에 쓰기
fileContents = null; //빠른 GC처리
}
System.out.println("==== 끝 ====");
}
}
'JAVA > Java 일반' 카테고리의 다른 글
| openjdk 11설치 방법 및 기본 설정- java 11 설치 (0) | 2019.03.18 |
|---|---|
| apache http client의 타임아웃 관련(기본 값 등) - 버전마다 틀릴 수 있음 (0) | 2019.02.08 |
| Java 변수 null처리에 따른 GC 테스트 샘플 (0) | 2018.06.18 |
| STS(Eclipse) 기본 셋팅 (0) | 2016.06.18 |
| Jenkins JOB 실행하는 프로그램 (0) | 2016.06.16 |
HTTPS를 통해 AWS CodeCommit 저장소(repository)에 인증하는 방법
2017. 6. 19. 00:46
참고
https://aws.amazon.com/ko/blogs/korea/introducing-git-credentials-a-simple-way-to-connect-to-aws-codecommit-repositories-using-a-static-user-name-and-password/
'성능테스트' 카테고리의 다른 글
| nGrinder 설치방법 정리 - 3.4Ver (0) | 2017.05.10 |
|---|
웹에서 ERD 그릴수 있는 툴(무료)
2017. 5. 25. 12:15
CentOS 7에 Mysql 5.7 설치
2017. 5. 17. 23:13
Step 1 - Add New Repository
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
(대상 버전은 https://dev.mysql.com/downloads/repo/yum/ 에서 최신버전 확인 가능)
Step 2 - Install MySQL 5.7
yum -y install mysql-community-server
Step 3 - Start MySQL and Enable Start at Boot Time
systemctl start mysqld
systemctl enable mysqld
#부팅시 자동으로 시작되도록 설정되어 있는지 확인
systemctl is-enabled mysqld
#3306포트로 실행되어 있는지 확인
netstat -plntu
Step 4 - Configure the MySQL Root Password
MySQL 5.7 is installed and started. As you can see, the MySQL root password for Ubuntu has been configured during the installation process, so we do not need to configure or reset the password on Ubuntu. But this is not the case on CentOS.
On CentOS 7, MySQL will generate a strong default password when MySQL is started the first time, the default password is shown in the mysqld.log file. You can use the grep command below for showing the default MySQL password.
grep 'temporary' /var/log/mysqld.log
Connect to the MySQL shell with the default password. (로그 파일에서 root 계정의 임시 비밀번호 확인 후 접속)
mysql -u root -p
TYPE DEFAULT PASSWORD
Now replace the default password with a new and strong password, with the MySQL query below.
ALTER USER 'root'@'localhost' IDENTIFIED BY '신규암호';
flush privileges;
#추가설정
mysql> status
characterset 값이 latin1 인것을 확인할 수 있는데, 이런 characterset 등 몇가지는 기본적으로 바꾸는게 좋다
설정 참고(inno db 튜닝 등도 하면 좋지만 이 글에서는 pass)
# vi /etc/my.cnf 후 아래 내용 참고하여 필요 부분 변경 후 -> systemctl restart mysqld -> mysql 접속해서 status로 확인하면 변경됨을 확인할 수 있음
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8
collation-server=utf8_general_ci
init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
character-set-client-handshake = FALSE
skip-character-set-client-handshake
[mysqldump]
default-character-set=utf8
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
default-character-set = utf8
[mysql]
default-character-set=utf8
'DB > Mysql' 카테고리의 다른 글
| 글로벌 서비스 개발시, Mysql 날짜/시간에 처리를 위한 데이터타입 확인 (0) | 2021.11.17 |
|---|---|
| Mysql n-gram을 이용한 검색 (2) | 2021.08.26 |
| Mysql full text 검색(전문 검색) 정리 (0) | 2019.05.06 |
| Mysql rules(with java) (0) | 2018.12.28 |
| Mysql 로그인 이력 저장을 위한 파티션 테이블 샘플(mysql history partition table) (0) | 2018.11.12 |
nGrinder 설치방법 정리 - 3.4Ver
2017. 5. 10. 18:18
메인 git : https://github.com/naver/ngrinder
설치 가이드 문서
#OS튜팅
echo "* soft nofile 655350" >> /etc/security/limits.conf
echo "* hard nofile 655350" >> /etc/security/limits.conf
vim /etc/security/limits.d/20-nproc.conf 후에 32768로 변경
#Java와 톰캣 설치
참고링크 : http://blog.eomsh.com/18
#nGrinder 컨트롤러를 톰캣에 설치
wget 'https://github.com/naver/ngrinder/releases/download/ngrinder-3.4.1-20170131/ngrinder-controller-3.4.1.war' -O ~/apps/apache-tomcat-8.0.43/webapps/ROOT.war
~/apps/apache-tomcat-8.0.43/bin/startup.sh
#접속 확인(필요시 앞단에 nginx 등을 설치 가능하며 톰캣포트는 conf/server.xml에서 변경)
http://localhost:8080
최초 ID/PW는 admin:admin 입니다.
#nGrinder 에이전트 설치(부하 발생기)
wget 'http://ngrinder컨트롤러서버도메인/agent/download' -O ngrinder_agent.tar
tar -xvf ngrinder_agent.tar
압축해제한 디렉토리로 이동 후 run_agent.sh
필요시 __agent.conf 파일의 설정을 수정
참고로 최초 실행후에는 ~/.ngrinder_agent 디렉토리에 설정파일 등이 존재하기에 해당 디렉토리에서 수정해야함
'성능테스트' 카테고리의 다른 글
| HTTPS를 통해 AWS CodeCommit 저장소(repository)에 인증하는 방법 (0) | 2017.06.19 |
|---|
mongo 3.4 설치방법 정리
2017. 5. 10. 14:35
참고
#OS튜닝
# nofile 및 nprc 갯수 튜닝
echo "* soft nofile 64000" >> /etc/security/limits.conf
echo "* hard nofile 64000" >> /etc/security/limits.conf
echo "* soft nproc 64000" >> /etc/security/limits.conf
echo "* hard nproc 64000" >> /etc/security/limits.conf
vim /etc/security/limits.d/20-nproc.conf 후에 64000으로 변경
Run the sysctl command below to apply the changed limits to the system:
sysctl -p
ulimit -a 명령어로 확인 가능
# repo 추가
vi /etc/yum.repos.d/mongodb-org-3.4.repo 이후 아래 입력
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
# 설치
yum install -y mongodb-org
# 기본 설정 작업
#huge 설정
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
#재 부팅시 자동으로 시작(필요시)
chkconfig mongod on
#몽고 데이터 저장 디렉토리 생성 및 mongod계정의 소유로 변경(예)
mkdir -p /data/mongo/repl_0
chown -R mongod:mongod /data
# 몽고 시작
#몽고 서비스 시작
systemctl start mongod
#몽고 프롬프트에 접속
mongo
#참고 : 몽고 삭제
systemctl stop mongod
#Remove any MongoDB packages that you had previously installed.
yum erase $(rpm -qa | grep mongodb-org)
#Remove MongoDB databases and log files.
rm -rf /var/log/mongodb
rm -rf /var/lib/mongo
#필요시
rm -rf /data
#참고 : 몽고 설정(/etc/mongod.conf)
특정파일의 config 파일을 이용하려면 mongod --config 파일경로 (이 명령어로는 root로 프로세스가 실행되니 필요시 init.d 등을 이용할수도 있음)
vi /etc/mongod.conf 후 아래샘플을 참고하여 수정해서 사용
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
quiet: true
storage:
dbPath: /data/mongo/repl_0
journal:
enabled: true
#wiredTiger:
#engineConfig:
#cacheSizeGB: 0.5
net:
port: 27017
#bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces. (주석으로 막으면 모든 IP에서 접속 가능. AWS에서는 SG로 보안처리 하고 있어서 편의상 모두 허용하기도 함)
replication:
replSetName: repl_set
#참고 : 몽고 replica 설정
primary가 될 서버에서 몽고 콘솔로 접속 : mongo
#Replica set 초기화
rs.initiate()
#Secondary 노드 추가
rs.add("secondary장비의 IP:27017")
#Arbiter 노드 추가
rs.add("arbiter장비IP:37017",arbiterOnly:true)
# 잘 저장되는지 테스트
use testdb
db.test_collection.insert({'msg':'test message'})
db.test_collection.find()
#Secondary에서는 아래 명령 실행 후 조회해 보면 됨
db.slaveOk(true)
#참고 - 1개 장비에 여러개의 몽고데몬을 실행시켜야할 경우
1개의 몽고DB를 설치하면 아래에 service 파일이 생성됨
/etc/systemd/system/multi-user.target.wants
해당 디렉토리의 mongod.service 심볼릭링크가 가리키는 파일(/usr/lib/systemd/system/mongod.service) 이 하나의 데몬 파일
/usr/lib/systemd/system/mongod.service 파일을 복사하여 한개 더 생성(ex. cp /usr/lib/systemd/system/mongod.service /usr/lib/systemd/system/mongod2.service)
복사한 해당 파일의 내용을 적당히 수정
예)
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual
[Service]
User=mongod
Group=mongod
Environment="OPTIONS=--quiet -f /etc/mongod2.conf"
ExecStart=/usr/bin/mongod $OPTIONS run
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb2
ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb2
ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb2
PermissionsStartOnly=true
PIDFile=/var/run/mongodb2/mongod.pid
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
[Install]
WantedBy=multi-user.target
설정들 데몬에 반영
systemctl daemon-reload
#참고 mongod.conf 1번
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
quiet: true
# Where and how to store data.
storage:
dbPath: /data/mongo/repl_0
journal:
enabled: true
# engine:
# mmapv1:
wiredTiger:
engineConfig:
cacheSizeGB: 0.4
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
# bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
#security:
#operationProfiling:
#replication:
replication:
replSetName: repl_set
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
#참고 mongod2.conf(1개 서버에 2개 프로세스 동시에 띄울때 사용할 목적)
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod2.log
# quiet: true
# Where and how to store data.
storage:
dbPath: /data/mongo/repl_1
journal:
enabled: true
# engine:
# mmapv1:
wiredTiger:
engineConfig:
cacheSizeGB: 0.4
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb2/mongod.pid # location of pidfile
# network interfaces
net:
port: 27018
# bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
#security:
#operationProfiling:
#replication:
replication:
replSetName: repl_set
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
'NoSql > mongo(또는 tokumx)' 카테고리의 다른 글
| mongodb 4.2서버에 java client 4.0.4로 커넥션 및 insert하는 샘플소스 (0) | 2020.07.07 |
|---|---|
| 몽고DB replica 재 설정 방법(샘플) (0) | 2019.09.04 |
| mongo 4.0 설치방법 정리 (0) | 2018.11.29 |
| tokumx 설치 (0) | 2017.04.18 |
| Mongo DB tokumx엔진 퀵 설치 방법 (0) | 2016.08.08 |