'분류 전체보기'에 해당되는 글 1583건
- 2021.09.30 [ngrinder] groovy script 작성 참고 문서.
- 2021.09.29 [Elastic] 초간단 모니터링 시스템 만들기
- 2021.09.27 [SpringBoot] Application 실행 시 특정 작업 실행 시키기
- 2021.09.16 [SpringBoot] 깡통 프로젝트 생성 후 실행 시 에러 (Error creating bean with name 'dataSource' defined in class path resource)
- 2021.09.15 [Gradle] 6.x 에서 7.x 로 넘어 오면서 runtime, compile.
- 2021.09.15 [Elasticsearch] _analyze API 예제 영단어 처리.
- 2021.09.14 [Java] List 중복 제거.
- 2021.09.09 [강의] Elasticsearch 동영상 강의 - 유료 3
- 2021.09.07 [Elasticsearch] Shard Awareness Allocation 사용 시 주의점.
- 2021.09.07 [ZSH] oh-my-zsh 설정 on Macbook.
[Elastic] 초간단 모니터링 시스템 만들기
Elastic 2021. 9. 29. 17:54구성요소)
- Elasticsearch
- Kibana
- Elastic Agents
Basic 용으로 Security Disabled 하고 사용 합니다. (Security 적용 하실 분은 API Key 생성과 User/Password 구성 하시면 됩니다.)
Elasticsearch + Kibana Security Disabled)
- elasticsearch.yml
- kibana.yml
xpack.security.enabled: false
Elastic Agents 설치)
https://www.elastic.co/guide/en/fleet/current/elastic-agent-installation.html
Standalone 으로 구성하고 설치가 필요한 장비에 설치 하면 됩니다.
(Fleet 구성은 테스트 해보지 않았구요. 필요 시 해보겠습니다.)
$ sudo ./elastic-agent install
EA Start & Stop on Mac)
- Start
$ sudo launchctl load /Library/LaunchDaemons/co.elastic.elastic-agent.plist
- Stop
$ sudo launchctl unload /Library/LaunchDaemons/co.elastic.elastic-agent.plist
Dashboard & Visualize)
Kibana 를 이용하시면 됩니다.
Alert)
이건 Elasticsearch 로 RESTful API 요청해서 Rule 에 따른 알람을 보내면 됩니다.
보통, WAS 로 구현해서 Slack 으로 보내거나, Scheduler 를 이용해서 Script 를 실행시켜 Slack 으로 보내거나 합니다.
[SpringBoot] Application 실행 시 특정 작업 실행 시키기
ITWeb/개발일반 2021. 9. 27. 12:39아래 세 가지 방법으로 실행 시킬 수 있습니다.
@Component
public class RunAfterApplicationStart implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) {
// 실행 코드
}
}
@Component
public class RunAfterApplicationStart implements CommandLineRunner {
@Override
public void run(String... args) {
// 실행 코드
}
}
@Component
public class RunAfterApplicationStart {
@EventListener(ApplicationReadyEvent.class)
public void hello() {
// 실행 코드
}
}
[SpringBoot] 깡통 프로젝트 생성 후 실행 시 에러 (Error creating bean with name 'dataSource' defined in class path resource)
ITWeb/개발일반 2021. 9. 16. 17:26springboot 프로젝트 만들어야 할 때 이용 합니다.
필요한 dependency 추가해 주고 로컬로 다운로드 받아 바로 실행 시켜 봅니다.
근데 깡통임에도 불구하고 에러가 발생을 했습니다.
mybatis 를 추가 했을 경우 application.yml 에 datasource 관련 설정을 하지 않게 되면 발생 하는 에러 입니다.
아래와 같이 설정을 추가 하고 build.gradle 에 mysql connector lib 도 추가해 주고 실행 하면 에러가 없어 집니다.
[error logs]
2021-09-16 17:24:18.201 WARN 76669 --- [ restartedMain] ConfigServletWebServerApplicationContext :
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [com.zaxxer.hikari.HikariDataSource]:
Factory method 'dataSource' threw exception;
nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException:
Failed to determine a suitable driver class
2021-09-16 17:24:18.205 INFO 76669 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
[application.yml]
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/...
username: ${USER}
password: ${PASSWORD}
[build.gradle]
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.26'
[Gradle] 6.x 에서 7.x 로 넘어 오면서 runtime, compile.
ITWeb/개발일반 2021. 9. 15. 17:51아래와 같이 변경 해서 사용 하면 됩니다.
- Gradle 6.x 에서 Gradle 7.x 로 넘어 오면서 runtime, compile.
[6.x]
task copyDependencies(type: Copy) {
into "$buildDir/libs/deps"
from configurations.runtime
}
[7.x]
task copyDependencies(type: Copy) {
into "$buildDir/libs/deps"
from configurations.runtimeClasspath
}
[6.x]
jar {
manifest {
attributes 'Main-Class': 'Main.class',
'Class-Path': configurations.compile.files.collect { "deps/$it.name" }.join(' ')
}
archiveName 'dictionary.jar'
from {
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
}
}
[7.x]
jar {
manifest {
attributes 'Main-Class': 'Main.class',
'Class-Path': configurations.compileClasspath.files.collect { "deps/$it.name" }.join(' ')
}
archiveName 'dictionary.jar'
}
[Elasticsearch] _analyze API 예제 영단어 처리.
Elastic/Elasticsearch 2021. 9. 15. 11:44아리랑을 이용한 영단어 처리와 특수문자 제거 예제 입니다.
_analyze API 예제 이고 index 에는 settings 에 선언 하시면 됩니다.
{
"tokenizer" : "arirang_tokenizer",
"filter": [
"arirang_filter",
{
"type": "stemmer",
"language": "possessive_english"
},
"lowercase",
"classic",
{
"type": "stemmer",
"language": "english"
}
],
"char_filter": {
"type": "pattern_replace",
"pattern": "\\p{Punct}",
"replacement": ""
},
"text": ""
}
text 부분에 분석할 문자열을 넣으세요.
[Java] List 중복 제거.
ITWeb/개발일반 2021. 9. 14. 12:34DictionaryModel 은 String, List<String> 맴버 변수를 가집니다.
이 맴버 변수 중 List<String> 을 모두 펼쳐서 distinct word 목록을 만들려고 합니다.
List<String> flats = new ArrayList<>();
List<String> words = new ArrayList<>();
for (DictionaryModel d : dictionarys ) {
words.addAll(d.getAnalyzed());
}
flats = words.stream().distinct().collect(Collectors.toList());
기억력을 돕기 위해 기록해 봅니다.
[강의] Elasticsearch 동영상 강의 - 유료
Elastic 2021. 9. 9. 20:53안녕하세요.
그 동안 제가 커뮤니티에 작게나마 질문에 댓글도 달고 일부 정보도 공유 하고 했었는데요.
좋은 기회가 생겨서 Elasticsearch에 대한 동영상 강의 컨텐츠 제작을 하게 되었습니다.
(유료 강의 입니다. ^^;)
제가 그 동안 Elasticsearch 를 어떻게 익혀 왔고 실 서비스에 적용은 또 어떻게 했는지 그리고 문제가 발생 했을 때 어떻게 문제를 해결해 나갔는지 본 강의를 통해서 모두 알려 드리려고 합니다.
기본 이론과 이론에 기반한 실습 그리고 최종 배운 것을 토대로 분석, 설계, 구축, 구현 까지 마무리 하는 과정으로 이루어져 있습니다.
처음 시작해 보시는 분이나 시작은 했으나 좀 더 동작 원리나 Elasticsearch 를 잘 다뤄 보고 싶으신 분들께 도움이 될거라고 생각 합니다.
강의를 들으시는 분들께 도움을 드릴 수 있도록 계속 노력 하겠습니다.
(문제가 된다면 삭제 처리 하겠습니다.)
P.S. Elasticsearch 레퍼런스 문서를 모두 정독 하신 분, 소스 코드를 정독 하신 분은 본 강의가 도움이 되지 않을 수 있습니다.
The RED : 검색엔진 구축을 위한 Elasticsearch 마스터 클래스 | 패스트캠퍼스
국내 1티어 검색 엔지니어 정호욱에게 엘라스틱서치 설치부터 기본구조, 핵심기능까지 배워보세요. 500페이지에 달하는 방대한 가이드를 효율적으로 활용하는 방법을 얻어가실 수 있습니다.
fastcampus.co.kr
[Elasticsearch] Shard Awareness Allocation 사용 시 주의점.
Elastic/Elasticsearch 2021. 9. 7. 23:30로컬에서 테스트 할 때 주의 해야 하는 점이 있습니다.
같은 shard 가 같은 host 장비에 할당 되게 하려고 아래와 같은 설정을 합니다.
cluster.routing.allocation.same_shard.host: true
그런데 이 설정으로 인해서 shard allocation 적용 시 동작 하지 않게 됩니다.
사용 시 위 설정에 대해서 반드시 확인 하고 사용 하세요.
(같은 실수를 몇 번 하는 지 ㅡ.ㅡ;;)
[ZSH] oh-my-zsh 설정 on Macbook.
ITWeb/개발일반 2021. 9. 7. 10:47또 뭔가 찾기 귀찮아서 기록해 봅니다.
[oh-my-zsh 설치]
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
[iTerm2 Color Schemes]
https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/schemes
[d2font 설치] (서체관리자 추가 및 iTerm 추가)
https://github.com/naver/d2codingfont
[highlighting]
$ brew install zsh-syntax-highlighting
$ vi .zshrc 하단에 추가
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
[Insecure Directory Skip]
$ vi .zshrc 제일 윗줄에 추가
ZSH_DISABLE_COMPFIX=true
[Theme 수정]
$ vi .zshrc 수정 및 추가
ZSH_THEME="agnoster"
...중략...
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]];
then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
fi
}
[newline 추가]
$ vi ~/.oh-my-zsh/themes/agnoster.zsh-theme
build_prompt() {
RETVAL=$?
prompt_status
prompt_virtualenv
prompt_aws
prompt_context
prompt_dir
prompt_git
prompt_bzr
prompt_hg
prompt_newline # <-- 추가
prompt_end
}
[newline & multiline 적용]
PROMPT='%{%f%b%k%}$(build_prompt) '
# 아래 6, 7번 라인은 아래와 같이 작성을 하셔야 정상적으로 나옵니다.
prompt_newline() {
if [[ -n $CURRENT_BG ]]; then
echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR
%{%k%F{blue}%}$SEGMENT_SEPARATOR"
else
echo -n "%{%k%}"
fi
echo -n "%{%f%}"
CURRENT_BG=''
}
[plugin 적용]
- zsh-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
$ vi .zshrc
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
web-search
jsontools
macports
node
osx
sudo
docker
iterm2
)