전체 글
Shell Script
Shell Script
2021.03.15linuxsig.org/files/bash_scripting.html Table 1: Built-in shell variables. Variable Use $# Stores the number of command-line arguments that were passed to the shell program. $? Stores the exit value of the last command that was executed. $0 Stores the first word of the entered command (the name of the shell program). $* Stores all the arguments that were entered on the command line ($1 $2 ...). "..
[Spring] WebClient
[Spring] WebClient
2021.03.14왜 WebClient ?: RestTemplate은 deprecated 예정. docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html NOTE: As of 5.0 this class is in maintenance mode, with only minor requests for changes and bugs to be accepted going forward. Please, consider using the org.springframework.web.reactive.client.WebClient which has a more modern API and supports syn..
[Oracle] longest match
[Oracle] longest match
2021.02.16https://dba.stackexchange.com/questions/42997/longest-prefix-search-in-oracle https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4246230700346756268 일단... 쿼리 하나로 해결하자면 이렇게도 가능은 한데, 성능 관점에서는? ```sql SELECT MIN(t.BIN_NO) KEEP (DENSE_RANK FIRST ORDER BY LENGTH(t.BIN_NO) DESC) FROM CARD_BIN t WHERE '654103' LIKE t.BIN_NO || '%'; ``` DBA 문의 결과... 다음과 같이 인덱스 걸고 ```sql create index CARD..
[Kotlin] java의 static final 변수에 대응되는 것은?
[Kotlin] java의 static final 변수에 대응되는 것은?
2021.02.11```kt class KakaoAuthHelper { companion object { const val REDIRECT_URI = "http://webpage-observer" val AUTHZ_CODE_URL = "https://kauth.kakao.com/oauth/authorize?client_id=${KakaoConfig.app_rest_api_key}&redirect_uri=${REDIRECT_URI}&response_type=code" } } ``` AUTHZ_CODE_URL은 변수가 들어가야 해서 const를 안붙였지만... Byte Code -> Java Decompile 해보면 ```java public static final String REDIRECT_URI = "http://web..
SonarQube
SonarQube
2020.12.08Pull Request decoration 기능? PR 시 changes만 가져와서 sonarqube 돌리고 이를 PR 댓글로 리포팅해주는 기능. SonarQube v7.2부터는 유료(Developer Edition)로 바뀜. 7.1 까진 무료 버전에서도 플러그인 형태로 제공. https://docs.sonarqube.org/display/PLUG/GitHub+Plugin https://github.com/SonarSource/sonar-github 7.1 무료버전에서 플러그인으로 설정하는 경우, PR에 대한 리포트는 SonarQube 서버에 저장되지 않는다. SonarQube 서버 report 저장 기능? 유료(Developer Edition)이 아니면, 어떤 브랜치에 대고 돌린 분석이든 모두 mast..
NGINX
NGINX
2020.12.04Reverse Proxy 실 운영 환경에서는 80, 443 빼고는 inbound를 막아두는 경우가 많아서 iptables 써서 80 -> xxxx로 포워딩하거나, nginx써서 80 -> xxxx로 포워딩한다. 후자를 더 많이 사용하는데 그 이유는 nginx를 쓰면 설정이 좀 귀찮기는 하지만, 한 장비에 여러 인스턴스를 띄우고 이들을 domain(혹은 location)으로 구분하므로 모두 80으로 받을 수 있다. jenkins나 sonarqube 등 설정 파일에서 home location (e.g., /jenkins)을 설정할 수 있도록 지원하는 것이 이 것 때문. 어차피 server IP가 변경될 상황을 대비해서 도메인을 쓰긴 써야하니 그럴 바에 nginx로 리버스 프록시하는게 낫다. IP로 hook ..
PostgreSQL 설치
PostgreSQL 설치
2020.12.04설치 ```bash sudo yum update -y yum list | grep postgre sudo yum install -y postgresql postgresql-server cat /etc/passwd -- postgres 계정 있는지 확인 ``` init ```bash sudo find / -name initdb 2>/dev/null sudo su - postgres initdb --encoding='utf8' sudo systemctl start postgresql sudo systemctl enable postgresql -- systemd가 알아서 실행 ``` 접근 ```bash sudo su - postgres psql -- postgres 계정으로 postgres DB에 로그인 됨...
Serverless computing platform의 장점
Serverless computing platform의 장점
2020.12.04Lambda에 대해서 적었지만, 이런 식의 Serverless computing platform의 활용처라고 생각하면 됨. N사는 사내에 Lambda라는 플랫폼을 제공하고 있음 Serverless computing platform = Function as a Service(Faas) = event-driven compute platform 별도의 서버 없이 특정 이벤트에 대응하여 코드를 실행하거나, 직접 코드를 실행할 수 있다. 급하게 개발해야 할 때나, 가볍게 개발해야 할 때 서버 신청 / 설정 / 관리 안해도 되니 부담 적음. 배포 필요 없이 수정하면 수정하는대로 바로 반영된다는게 장점. 이러한 플랫폼의 장점과 언제 어떻게 사용하면 유용한지? A. 유저가 직접 기능 확장이 필요할 때 내 생각에 이런 ..
[Java] Collection 초기화
[Java] Collection 초기화
2020.11.02www.baeldung.com/java-init-list-one-line www.baeldung.com/java-initialize-hashmap www.baeldung.com/java-combine-multiple-collections ```java Arrays.asList(“a”, “b”, “c”); String[] strs = {"a", "b", "c"}; ``` 자바의 immutable? ```java private static final Thing[] PRIVATE_VALUES = { ... }; public static final List VALUES = Collections.unmodifiableList(Arrays.asList(PRIVATE_VALUES)); ``` ```java retur..
[Java8] CompletableFuture
[Java8] CompletableFuture
2020.10.13CompleatbleFuture에 대해 https://medium.com/@chanhyeonglee/completable-future-가이드-part-1 https://medium.com/@chanhyeonglee/completable-future-가이드-part-2 https://medium.com/@chanhyeonglee/completable-future-가이드-part-3 thenCompose VS thenApply thenCompose VS thenApply thenCompose는 Future 다음에 또 다른 Future를 이어서 실행하게끔 연결할 때 사용 thenApply는 Future 결과를 받았을 때 반환 전에 어떤 처리를 apply 할 때 사용 exception handling : exc..
[Python] 파이썬 버전, 패키지 관리
[Python] 파이썬 버전, 패키지 관리
2020.10.10뭘 쓰든 한가지 방법으로 통일해서 관리하는게 좋음. pyenv / venv / virtualenv / conda 비교 pyenv windows는 지원 안함. python 버전 관리를 위해 쓰는거라. 특정 버전에 종속적인게 아니다. brew install ... python 자체 버전 관리를 위해 사용. 따라서 패키지 관리는 virtualenv 등과 연계해서 사용해야 한다. pyenv 하위로 virtualenv를 사용할 수 있다. (이게 좀 더 낫다.) pyenv-virtualenv를 사용하는 방법이 에러로 불가한 경우? python 버전은 pyenv로 관리하고, 해당 python 버전의 venv 모듈로 가상환경 만들면서 [python + 패키지]를 가상환경으로 묶는 방법을 사용해도 된다. venv pyt..
DB 이중화 / 클러스터링
DB 이중화 / 클러스터링
2020.09.23DB 클러스터링 DB 장애 시 가용성을 유지하기 위한 클러스터링 방안 Oracle 기준이긴 하지만, 다른 DB에서도 비슷한 옵션이 있는 경우 있음. HA ( High Availability ) 같은 장비를 Active 1대 , Standby 1대로 구성해서 Active에 문제 생기면 Standby로 서비스 하는 방식. Active, Standby 각자가 별도 storage를 가지고 있음. => Active와 Standby의 데이터 동기화 문제 및 성능 저하 => Active 가 죽고 Standby로 전환되기 전 그 사이에 발생하는 트랜잭션은 유실됨 - 데이터 불일치. 정합성 bad *** 오라클에서는 데이터 가드 라는 이름으로 제공하고 있다. *** 위와 같은 문제점 때문에 OPS 방식이 8i 버전까지 ..