글

kubespray node 추가 이슈 (rockyos)

rook을 설치 전 커널 버전은 4.17 이상을 권장 (pvc을 통한 할당이 안된다고 하는데 잘모르겠음) 참고 사이트  https://rook.io/docs/rook/v1.9/pre-reqs.html If you will be creating volumes from a Ceph shared file system (CephFS), the recommended minimum kernel version is 4.17. If you have a kernel version less than 4.17, the requested PVC sizes will not be enforced. Storage quotas will only be enforced on newer kernels. centos7인 경우 커널 버전 낮은 이슈로 곧 eos 문제가 될 centos8 대신 rocky 설치

avro maven plugin

$mvn avro:help [INFO] Scanning for projects... [INFO] [INFO] --------------------------< com.mspark:kafka >-------------------------- [INFO] Building kafka 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- avro-maven-plugin:1.9.1:help (default-cli) @ kafka --- [INFO] Apache Avro Maven Plugin 1.9.1   Maven plugin for Avro IDL and Specific API Compilers This plugin has 5 goals: avro:help   Display help information on avro-maven-plugin.   Call mvn avro:help -Ddetail=true -Dgoal=<goal-name> to display parameter   details. avro:idl-protocol   Generate Java classes and interfaces from AvroIDL files (.avdl) avro:induce   Generate Avro files (.avsc and .avpr) from Java classes or interfaces avro:protocol   Generate Java classes and interfaces from Avro protocol files (.avpr) avro:schema   Generate Java classes from Avro schema files (.avsc) avro:induc...

mac os openjdk 설치

brew tap AdoptOpenJDK/openjdk brew cask install adoptopenjdk8

docker로 kafka 환경 구축하기

centos 기반으로 설치를 진행 했으나 아래의 단점이 발견 되어 docker-compose로 로컬 환경을 구축 하였음 단점  - 설치가 귀찮다  - docker 시작시 zookeeper나 kafka 기동이 귀찮다.  - 깜박하고 container에 port 오픈을 안했다.... 아래의 사이트를 참고하여 docker-compose 구성 https://miiingo.tistory.com/196 docker-compose.yaml version: '2' networks: test: services: zookeeper: image: wurstmeister/zookeeper:3.4.6 container_name: zookeeper ports: - "2181:2181" networks: - test kafka: image: wurstmeister/kafka:2.12-2.4.1 container_name: kafka environment: KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_CREATE_TOPICS: "test:1:1" # Topic명:Partition개수:Replica개수 volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - "9092:9092" depends_on: - zookeep...

[이슈] nginx https과 http 2.0

하나의 webserver 설정에 https와 http 2.0를 혼재하여 사용할 경우  예를 들어 a.com, b.com 있을 경우 b.com 'server {}' 설정에만 http2 설정이 있을 경우  크롬 브라우저에서  ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY 가 발생한다. HTTP2  부적절한 전송 보안 오류? nginx 설정 중 하나의 server 디렉티브에 http 2.0 설정을 하였을 뿐인데 전체 서버에 영향을 받는거 보니 내부 로직에 이슈인지 ? 잘 모르겠다. 테스트 해 볼만한 케이스는 1. default 서버 설정, 2. 모두 http 2.0으로 변경 이 있을 것 같다. 1. default 서버 설정    - 의미 없음    2. 모든  server 디렉티브를 http 2.0으로 변경할 경우    - 정상 처리됨 (내부 was에서 오류가 나지만.) 일단 해당 이슈는 모두 http2.0를 사용 안하는 방향으로 수정.

Kafka 환경 구축 하기

OS : Centos Docker를 통해 Centos 환경을 만든다. (최초 수행 시) docker run --name centos -it centos /bin/bash (이후 수행 시) docker exec -it centos /bin/bash Java 1.8 설치 $ yum install java-1.8.0-openjdk-devel 주키퍼 설치 $ yum install wget $ wget "https://downloads.apache.org/zookeeper/zookeeper-3.6.0/apache-zookeeper-3.6.0-bin.tar.gz" $ tar -xvzf apache-zookeeper-3.6.0-bin.tar.gz $ mkdir -p /usr/local/zookeeper $ mv apache-zookeeper-3.6.0-bin/* /usr/local/zookeeper $ mkdir -p /var/lib/zookeeper $ cat > /usr/local/zookeeper/conf/zoo.cfg << EOF > tickTime=2000 > dataDir=/var/lib/zookeeper > clientPort=2181 > EOF $ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk $ /usr/local/zookeeper/bin/zkServer.sh start 설치 확인 $ yum install telnet $ telnet localhost 2181 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. srvr Zookeeper version: 3.6.0--b4c89dc7f6083829e18fae6e446907ae0b1f22d7, built on 02/25/2020 14:38 GMT Latency m...

docker centos 환경 만들기

docker run --name centos -it centos /bin/bash docker exec -it centos /bin/bash

opendistro multi tenant

이미지
multi tenancy를 사용 하려는 이유는 보안과 사용자별 불필요함을 제거하기 위함 opendistro에서는 multi tenancy를 지원 아래와 같이 사용하면 된다 1. tenancy 생성 2. + 를 눌러 신규 tenant  생성 3. Roles에 들어가서 4. + 눌러 신규 Role 생성 5. Tenant Perminssion에서 생성한 tenant에 권한을 줌 6. 저장 7. Roles Mappings에서 Rule과 user를 연결 만일 기존의 kibana에 데이터를 복제하여 구성 하고 싶다면 reindex api를 통해 기존 kibana index를 신규 tenant 의 kibana index에 복제하면 됨 POST _reindex { "source": { "index": ".kibana" }, "dest": { "index": ".kibana_-906336856_search" } } 끝

kibana index 정리

이미지
kibana와  elasticsearch를 업그레이드를 하면서 여러개의 .kibana index가 생성됨 이를 정리 하기 위해 현재 kibana가 사용하는 index를 알 필요가 있음 alias api를 통해 해당 부분을 확인 가능 GET /_alias aliases 가 .kibana 로 걸린 인덱스가 현재 사용하고 있는 kibana 인덱스 임 나머지 인덱스는 삭제...

[이슈] elasticsearch replica 가 동작하지 않음

이미지
index에 replica 설정이 되지 않는 이슈가 있음 아래의 명령을 수행 하면  allocation에 대한 정보가 나옴 GET /_cluster/allocation/explain?pretty 위 정보를 확인 하여 원인 파악 원인은 elasticsearch upgrade 시 io 지연을 줄이기 위해 수행 하였던 아래의 api가 문제가 됨 PUT _cluster / settings { "persistent" : { "cluster.routing.allocation.enable" : "primaries" } } 아래와 같이 api를 호출하면 풀림 PUT _cluster / settings { "persistent" : { "cluster.routing.allocation.enable" : null } } 현재는 아래와 같이 green이 됨

Exception : PreFlightHandler can not casting

Spring Interceptor에서 PreFlight Request (CORS 인식을 위한 OPTIONS 요청)에 대해서 HandlerMethod로 케스팅 한 경우 발생. 해결 방법은 instanceof로 체크 하면 됨 ---- 관련 자료) PreFlightHandler 클래스  private class PreFlightHandler implements HttpRequestHandler { private final CorsConfiguration config ; public PreFlightHandler(CorsConfiguration config ) { this . config = config ; } @Override public void handleRequest(HttpServletRequest request , HttpServletResponse response ) throws IOException { corsProcessor .processRequest( this . config , request , response ); } } PreFlightHandler를 사용하는 메소드 AbstractHandlerMapping.getCorsHandlerExecutionChain Update the HandlerExecutionChain for CORS-related handling. For pre-flight requests, the default implementation replaces the selected handler with a simple HttpRequestHandler that invokes the configured  setCorsProcessor(org.springframework.web.cors.CorsProcessor) . For actual requests, the default impleme...

puppeteer 이슈 사항

1. 긴 페이지 스크린 샷 짤리는 현상 참고 :  https://bugs.chromium.org/p/chromium/issues/detail?id=770769&desc=2 crop를 이용하여 처리  2. addScriptTag 메소드 puppeteer version 0.11.0에서 파라미터가 api 문서와 다름  문서 대로 작성하면 hang이 걸림, 파라미터로 url 값만 넘겨야 함 참고 : https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageaddscripttagoptions /node_modules/puppeteer/lib/Page.js 224   /** 225    * @param {string} url 226    */ 227   async addScriptTag(url) { 228     return this.mainFrame().addScriptTag(url); 229   } 230  3. mac에서는 screenshot 속도가 느림 (참고 :  https://bugs.chromium.org/p/chromium/issues/detail?id=741689&can=1&q=is%3Astarred%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified ) centos [tomcat@local-centos src]$ node fullpage-snapshoot.js { width: 860, height: 26432 } snapshot: 1914.957ms macos (os x el capita...

headless chrome with puppeteer

headless software 그래픽 유저 인터페이스 없이 동작하는 소프트웨어 참고 :  https://en.wikipedia.org/wiki/Headless_software headless chrome 그래픽 유저 인터페이스 없이 동장하는 크롬 브라우저 환경 구성 mac 페러럴즈 centos 7 minimal 버전 설치 (wget 설치)  sudo yum install wget (net-tools 설치)  sudo yum install net-tools nodejs 설치 epel(extra package for enterprise linux) 저장소 추가 (체크) yum repolist (추가) sudo yum install epel-release (체크) yum repolist nodejs (current 6.11.3-1)설치 (설치) sudo yum install nodejs node upgrade  puppeteer는 node 6.4 버전 이후 지원이며, async/await를 사용하려면 7.6 이상 버전이 설치 되어야 한다. (버전 확인) node -v (npm 캐쉬 제거) sudo npm cache clean -f (n 모듈 설치) sudo npm install -g n (node upgrade) sudo n latest n 모듈로 설치 시 /usr/bin/node 버전은 6, /usr/local/bin/node 8버전이 설치됨 (별로임) puppeteer 설치 yarn 설치  (yarn repo 추가) sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo (yarn 설치) sudo yum install yarn puppeteer 설치 mkdir ~/test cd test yarn ad...

linux에서 httpd init 제거

1. chkconfig httpd off 2. service httpd stop 3. chkconfig --list | grep "httpd" 가 모두 off 인지 확인

jenkins git local 옵션 오류

이미지
git plugin 설치 이후 ~~의 구성요소 중 GIT 설정시 아래와 같은 오류가 발생한다. Failed to connect to repository : Command "git config --local credential.username 유저명" returned status code 129: stdout:  stderr: error: unknown option `local' usage: git config [options] 위 오류를 처리 하기위해서는 git update( 1.7.12) 가 필요하다. 관련 URL :  http://stackoverflow.com/questions/23104110/unknown-option-git-config-local-reported-by-jenkins git update 방법 관련 URL :  http://tecadmin.net/how-to-upgrade-git-version-1-7-10-on-centos-6/

produces 와 consume

- 이슈 사항  : euc-kr를 사용하는 웹 페이지에서 (XP-IE7)에서 api의 응답이 깨지는 현상 - 처리 방법  : http 헤더 조사   - Accept-Charset : 응답 시 해당 charset으로 설정 요청   - Context-Type 내 charset : 요청에 대한 charset  : server 에서 처리 방법   - @RequsetMapping내에 produces는 accept요청 헤더를 봄   - @RequestMapping내에 consumes는 content-type에 대응 * jsonp인 경우 http header 수정 불가  - 이유 : jsonp인 경우 내부에서 <script ~~ >로 처리 되기 때문 =_= 결국 파라미터 방식으로 처리

Spring with Jsonp

이슈 상황 1. spring mvc를 이용하여 이미 controller는 작성된 상태이다. 2. 해당 controller는 @ResponseBody를 이용하여 작성되었다. 3. 모바일 웹(웹 서버와 다른 호스트) 을 이용하여 특정 url의 json을 가져 와야 한다. (JSONP 사용) 4. 특정 url는 확장자가 없다. (=_=;; restful도 아닌데.. 확장자 지정을 안했다.) 개선 방법 controller는 건들지 않는 방법이 좋을 듯 했다. Controller에 대한 exception 처리도 있고. 고쳐야 될 부분이 많다. 처리  1. intercepter로 response를 수정하려 하였지만.. @ResponseBody인 경우 intercepter로 처리 할 수 없다. (실패) 2.  MessageConverter 중  MappingJacksonHttpMessageConverter를 확장.  그러나 본인은  MappingJackson2HttpMessageConverter 사용하였고 이 클래스 에서는 멤버변수의 접근 제어가  MappingJacksonHttpMessageConverter와 달라서 적용이 안된다. (실패) (예제 :  http://aircook.tistory.com/106    MappingJacksonHttpMessageConverter의 확장 통한 jsonp 구현) 3. Servlet Filter를 이용한 처리(성공) (예제 :  http://patrickgrimard.com/2010/07/28/tutorial-implementing-a-servlet-filter-for-jsonp-callback-with-springs-delegatingfilterproxy/ ) 추가 이슈  1. Filter가 적용 안됨 <<문제의 filter 구문>...

특정 문자열 앞에 라인번호 넣기

해당 이슈는 하나의 문서내에서 특정 문자 뒤에 문서내 primary key 처럼 사용되는 값을 생성해 내기 위함이다. 단. 특정 문자는 단독으로 1line을 차지한다. <<입력>> 특정문자 문자열 문자열 문자열 특정문자 문자열 문자열 문자열 문자열 문자열 문자열 문자열 문자열 문자열 특정문자 <<출력>> 특정문자1 문자열 문자열 문자열 특정문자3 문자열 문자열 문자열 문자열 문자열 문자열 문자열 문자열 문자열 특정문자7 처리 순서 1. vi로 해당 파일을 연다 2. :%s/특정문자/\=printf('특정문자%-4d', line('.'))/gc 참고 사이트 http://vim.wikia.com/wiki/Insert_line_numbers

코딩 문제

손코딩을 할때 지우고 다시 쓰고 지우고 쓰는 바람에...대단한 실수을 했다... 이를 통해 배운것은...손코딩시..글씨는 작게.. 여백은 많게 해서 지워야 되는 상황을 막아야 겠다. 하지만 이것도 운명겠지 하고 넘어가자 ... 어찌되었던..기억을 더듬어서 그때 미처 완성하지 못한 코드를 작성해 본다.. 아래 코드는 =_=; 실행이 안될수도 있음...메모장 코딩이기 때문에.. =0=; //피보나치 수열의 인덱스의 값 구하기 function int fibo(idx) {    //피보나치 배열는 전전 값 + 전 값의 나열이기 때문에 idx 0과 1는 바로 리턴한다.    if(idx == 0) return idx;    if(idx == 1) return idx;    return fibo(idx - 1) + fibo(idx - 2); } //연속 반복 문자 개수 구하기 =_=;;이것만 풀었음..ㅠㅠ //A = "aaBBcDDD" --> 3이 나오는 함수..... function int dupCounf(String str) {     int ret = 0;     Char[] chars = str.toCharArray();     Char bchar = null;     boolean flag = false;     for(int = 0; i<chars.length; i++) {         if(chars[i] == bchar) {             if(flag == false) {                 ret++;         ...

spring + mybatis sqlSessionFactory mapperLocations 설정 관련

일반적으로 mapperLocations을 지정 할때는 ant pattern을 이용하여 값을 지정하는데 이번 케이스는 mapperLocation을  folder별로 지정하였으때 지정 하는 방법이다. 1. 기존 방식 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath:/db/mybatis/mapper/hsql/common/*.xml" /> <property name="configLocation" value="classpath:/db/mybatis/mybatis-crawling.xml" /> </bean> 2. Folder 별로 지정 하는 방식 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations"> <array> <value>classpath:/db/mybatis/mapper/hsql/common/*.xml</value> <value>classpath:/db/mybatis/mapper/hsql/web/*.xml</value> </array...