'2021/07'에 해당되는 글 10건

  1. 2021.07.27 [OpenJDK] 다운로드 받아서 설치.
  2. 2021.07.27 [Bash] 문자열 비교 예제
  3. 2021.07.19 [HikariCP] Java 버전 호환
  4. 2021.07.15 [JUnit] intellij 에서 junit 테스트 코드 작성 시 경험 하는 에러.
  5. 2021.07.14 [Docker] 로컬에 MySQL 설치 합니다.
  6. 2021.07.12 [Elasticsearch] Field Name Length Limit.
  7. 2021.07.06 [Elasticsearch] arirang dictionary 에 영어+한글 복합어 분해 추가.
  8. 2021.07.06 [Elasticsearch] bin/start, bin/stop
  9. 2021.07.05 [Elasticsearch] Bulk Request by Restful API
  10. 2021.07.02 [Intellij] intellij-java-google-style.xml 적용하기

[OpenJDK] 다운로드 받아서 설치.

ITWeb/개발일반 2021. 7. 27. 09:46

아래 주소에서 설치할 버전 선택 후 다운로드 받아서 설치 하셔도 됩니다.

 

Early Access

https://download.java.net/java/early_access/jdk18/7/GPL/openjdk-18-ea+7_linux-x64_bin.tar.gz

 

GA

https://jdk.java.net/archive/

 

AdoptOpenJDK

https://adoptopenjdk.net/release_notes.html

https://adoptopenjdk.net/archive.html?variant=openjdk8&jvmVariant=hotspot 

 


                  

:

[Bash] 문자열 비교 예제

ITWeb/개발일반 2021. 7. 27. 08:11
#!/bin/bash

retry='retry'

if [ $retry = "retry" ]; then
  echo 'true - 1'
fi

if [[ $retry = "retry" ]]; then
  echo 'true - 2'
fi

if [[ "$retry" = "retry" ]]; then
  echo 'true - 3'
fi

세 예제 다 true 리턴 합니다.

:

[HikariCP] Java 버전 호환

ITWeb/개발일반 2021. 7. 19. 11:46

빌드 환경과 맞춰서 사용 하셔야 합니다.

안그러면 아래와 같은 에러를 경험 할 수 있습니다.

 

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/zaxxer/hikari/HikariConfig has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

 

Artifacts
Java 11+ maven artifact:

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP</artifactId>
   <version>5.0.0</version>
</dependency>
Java 8 maven artifact (maintenance mode):

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP</artifactId>
   <version>4.0.3</version>
</dependency>
Java 7 maven artifact (maintenance mode):

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP-java7</artifactId>
   <version>2.4.13</version>
</dependency>
Java 6 maven artifact (maintenance mode):

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP-java6</artifactId>
   <version>2.3.13</version>
</dependency>

 

:

[JUnit] intellij 에서 junit 테스트 코드 작성 시 경험 하는 에러.

ITWeb/개발일반 2021. 7. 15. 09:42

아래와 같은 에러를 경험 하셨다면 intellij 에서의 설정을 변경해 주시면 됩니다.

 

Execution failed for task ':test'.
> No tests found for given includes: [com.kakaopay.stark.pipeline.indexer.PropertiesTest.testMultilineProperty](filter.includeTestsMatching)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

 

IntelliJ -> Preferences -> Build,Execution,Deployment -> Build Tools -> Gradle

Gradle projects -> Run tests using -> Gradle (Default) 를 Intellij IDEA 로 바꾸시면 됩니다.

:

[Docker] 로컬에 MySQL 설치 합니다.

Cloud&Container/IaC 2021. 7. 14. 19:39

요즘 잘 되어 있는 container 기반으로 구성 하면 되지 않겠습니까?

 

version: '3.7'

services:
  db:
    image: mysql
    container_name: local-mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: local
      MYSQL_USER: henry
      MYSQL_PASSWORD: henry
      MYSQL_DATABASE: henry
    volumes:
      - ./data:/var/lib/mysql
    ports:
      - 3306:3306

  adminer:
    image: adminer
    restart: always
    ports:
      - 8888:8888

$ docker-compose up -d

이제 client tool 을 이용해서 접속해 보시면 됩니다. :)

:

[Elasticsearch] Field Name Length Limit.

Elastic/Elasticsearch 2021. 7. 12. 19:23

기억력을 돕기 위해서 기록 합니다.

 

참고 문서)

https://www.elastic.co/guide/en/elasticsearch/reference/master/mapping-settings-limit.html

 

index.mapping.field_name_length.limit)

Setting for the maximum length of a field name. 
This setting isn’t really something that addresses mappings explosion 
but might still be useful if you want to limit the field length. 
It usually shouldn’t be necessary to set this setting. 
The default is okay unless a user starts to add a huge number of fields with really long names.

Default is Long.MAX_VALUE (no limit).

mapping explosion 과 같은 경우에 유용 할 수 있다는 이야기 입니다.

기본은 노 제한!!

 

보너스로 그럼 Index 명은 얼마인가요?

- 255 bytes 입니다. (실제 멀티바이트 문자 이기 때문에 더 짧습니다.)

- https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#indices-create-api-path-params

 

그냥 궁금해서 추가적으로 cluster.name 과 node.name 의 max length 는 어떻게 될까 찾아 봤는데요.

Java 의 Sting 클래스의 max length 라고 보시면 됩니다.

그러나 cluster.name 과 node.name 은 가독성이 중요 하기 때문에 저렇게 길게 작명 하는 나쁜 부모는 되지 말아야 겠죠.

:

[Elasticsearch] arirang dictionary 에 영어+한글 복합어 분해 추가.

Elastic/Elasticsearch 2021. 7. 6. 14:59

그냥 작은 운영 팁 정도 입니다.

 

영어+한글로 작성된 경우 둘 다 사전에 등록 되어 있지 않다고 하면 아래와 같이 등록을 하면 됩니다.

 

예) kr모터스

extension.dic 에 한글 "모터스" 만 등록 합니다.

모터스,100000000X

 

POST http://localhost:10800/_analyze

Request)

{

"tokenizer": "arirang_tokenizer",

"filter": [

"arirang_filter"

],

"text": "kr모터스"

}

 

Response)

{

"tokens": [

{

"token": "kr모터스",

"start_offset": 0,

"end_offset": 5,

"type": "korean",

"position": 0

},

{

"token": "kr",

"start_offset": 0,

"end_offset": 2,

"type": "word",

"position": 0

},

{

"token": "모터스",

"start_offset": 2,

"end_offset": 5,

"type": "korean",

"position": 1

}

]

}

:

[Elasticsearch] bin/start, bin/stop

Elastic/Elasticsearch 2021. 7. 6. 13:16

분명 어딘가에 기록해 두었던 것 같은데 또 못찾고 있다.

그래서 손꾸락이 기억 하라고 작성해 봅니다.

 

- Elasticsearch start
#!/bin/bash

DIR_NAME=`dirname "$0"`
DIR_HOME=`cd $DIR_NAME; cd ..; pwd`

ES_JAVA_OPTS="-Xms512m -Xmx512m" $DIR_HOME/bin/elasticsearch -d -p $DIR_HOME/PID

- Elasticsearch stop
#!/bin/bash

DIR_NAME=`dirname "$0"`
DIR_HOME=`cd $DIR_NAME; cd ..; pwd`

pkill -F  $DIR_HOME/PID

 

:

[Elasticsearch] Bulk Request by Restful API

Elastic/Elasticsearch 2021. 7. 5. 15:41

공홈 문서 보시면 됩니다.

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

 

워낙에 제가 예전에 작성해 놓은 글이 있어서 그냥 최신 버전으로 remind 합니다.

$ curl -s -H "Content-Type: application/x-ndjson" -XPOST http://localhost:9200/_bulk 
  --data-binary "@ATC.json"

 

ATC.json)

{"index": { "_index": "atc", "_id": "1"}}
{"chosung": "ㄴㅇㅋ", "chosung_eng": "nike", "jamo_kor": "ㄴㅏㅇㅣㅋㅣ", "jamo_eng": "skdlzl", "item_kor": "나이키", "item_eng": "nike"}

 

:

[Intellij] intellij-java-google-style.xml 적용하기

ITWeb/개발일반 2021. 7. 2. 10:10

intellij 버전이 올라 가면서 codestyle 정의가 바뀌었네요.

https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml

이전 글은 import 방법만 참고하시고 새로운 style 을 다운로드 받아서 적용해 보세요.

 


 

각자 필요한 코드 스타일은 아래서 다운로드 받으시면 됩니다.

 

[구글 코드 스타일]

https://github.com/google/styleguide

 

[Intellij 적용하기 - mac]

# 저는 intellij 2016.3 사용중입니다.

# 다운로드 받으신 intellij-java-google-style.xml 파일을 아래 경로로 복사해서 넣습니다.

 

$ cd ~/Library/Preferences/IntelliJIdea2016.3/codestyles

 

[Intellij 에서 import 하기]

Preferences -> Editor -> Code Style -> Manage Button -> Import

 

# 그러나 파일을 먼저 복사해 넣었기 때문에 import 하지 않으셔도 scheme 이 정상적으로 나옵니다.

# Scheme 을 GoogleStyle 로 변경 하시면 끝납니다.

 

: