일래스틱서치에서 인덱스에 대해서만 앨리어싱을 사용할 수 있었는데,



일래스틱서치 6.4 부터 필드에 앨리어싱을 추가할 수 있다.


https://www.elastic.co/guide/en/elasticsearch/reference/6.4/alias.html




PUT trips
{
  "mappings": {
    "_doc": {
      "properties": {
        "distance": {
          "type": "long"
        },
        "route_length_miles": {
          "type": "alias",
          "path": "distance" // 
        },
        "transit_mode": {
          "type": "keyword"
        }
      }
    }
  }
}

GET _search
{
  "query": {
    "range" : {
      "route_length_miles" : {
        "gte" : 39
      }
    }
  }
}



그러나 요청은 가능하지만 json 응답은 앨리어스의 원본으로 결과가 나온다.


또한,  https://github.com/elastic/elasticsearch/issues/37212 에 따른대로 percolator(elasticsearch - alert)에서도 적용되지 않는다.



유의할 필요가 있다.



Posted by '김용환'
,

NIFI-인증

Cloud 2019. 3. 14. 17:25




nifi에 인증을 추가할 수 있다. 디폴트로 인증 방법을 제공하지 않는다.


3가지 인증 방식은 다음과 같고, 링크를 참고한다.



간단하게 파일,
Apache Ambari의 Ranger를 이용,

사용자 정의 플러그인



아래 자료 참고.

https://medium.com/@jayprakash.bilgaye/understanding-ssl-and-ldap-in-hdf-504844bea8b9




https://community.hortonworks.com/articles/60842/hdf-20-defining-nifi-policies-in-ranger.html



Posted by '김용환'
,


sentry 1.7.x 에서

sentry 설정을 제대로 한 것 같은 데 에러가 아래와 같이 발생할 수 있다.



<appender
name="SENTRY" class="io.sentry.logback.SentryAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>

<root level="INFO">
<appender-ref ref="ROLLING" />
<appender-ref ref="STDOUT" />
<appender-ref ref="SENTRY"/>
</root>


ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [io.sentry.logback.SentryAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type io.sentry.logback.SentryAppender


이유는 다음 io.sentry:sentry-logback도 함께 추가했어야 했는데. 못했기 때문에 에러가 발생한 것이다.


<dependency>

    <groupId>io.sentry</groupId>

    <artifactId>sentry-logback</artifactId>

    <version>1.7.16</version>

</dependency>



Posted by '김용환'
,

sentry-logback 연동

etc tools 2019. 3. 12. 16:37


sentry는 계속 변화되고 있다. 따라서 공식 문서를 보는 것을 가장 추천한다. 




logback에 sentry 연동 코드를 추가하는 정보이다.


sentry 서버를 아래대로 따라 설치한 후, cdn키를 (https://주소/프로젝트/settings/key) 복사한다.


UI만 참고하기 ': https://kykkyn2.tistory.com/74,  https://www.lesstif.com/pages/viewpage.action?pageId=30705133







https://docs.sentry.io/clients/java/



logback 설정은 대략 다음과 같다. 

<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>

<root level="INFO">
<appender-ref ref="ROLLING" />
<appender-ref ref="STDOUT" />
<appender-ref ref="SENTRY"/>
</root>


라이브러리는 다음을 추가한다.(sbt 기준)

"io.sentry" % "sentry" % "1.7.16",
"io.sentry" % "sentry-logback" % "1.7.16"

sentry.properties는 다음과 같이 저장한다(classpath에만 두면 sentry 코드에서 알아서 읽는다)

dsn=https://111:222@clog.google.com/315?timeout=300&async.queuesize=100
release=1.0.0
stacktrace.app.packages=





Posted by '김용환'
,


참조할만한 쿠버네티스 자료


2018년 소스콘-ci/cd in k8s


https://www.soscon.net/pdf/day2_1150_2.pdf


https://betsol.com/2018/11/devops-using-jenkins-docker-and-kubernetes/


https://akomljen.com/set-up-a-jenkins-ci-cd-pipeline-with-kubernetes/



Posted by '김용환'
,


jenkins pipeline에서 withMaven을 그냥 사용하면 


java.lang.NoSuchMethodError: No such DSL method 'withMaven' found among steps 에러가 발생한다.




Pipeline Maven Integration Plugin을 설치한다.


'Tool' 카테고리의 다른 글

td-agent 모니터링  (0) 2019.10.28
맥OS 에서 숨은 파일 찾기  (0) 2019.01.09
tmux 사용 방법  (0) 2018.12.19
[git] no kex alg 이슈  (0) 2018.06.20
[intellij] 2018.1 lombok 설정  (0) 2018.06.19
Posted by '김용환'
,



Jenkins 에서 GitHub 저장소 소스를 읽어올 때. ssh 가 아닌  https로 접근하고 싶을 때. 

credentials를 사용할 수 있다.


(kubernetes 환경에서는 ssh보다는 https가 훨씬 적합한 것 같다)





 


아래 화면에서 Read 권한을 가진 토큰을 생성한다.


https://github.com/settings/tokens



그리고 credential 화면에서 username with password 를 선택하고..

username에는 깃허브 사용자 id,

password에는 사용자의 토큰 값을 저장한다.



그리고 jenkins job 내부에서 credential을 잘 사용하면 된다. 

Posted by '김용환'
,





대기업에서는 Proxy를  두어 외부 인터넷 연결을 제어한다. 


다만 내부 머신에서 외부 인터넷으로  제대로 패킷이 나가는지 테스트하려면 다음 코드로  테스트한다.



<Proxy.java>



import java.io.*;

import java.net.*;

import java.util.Properties;


public class Proxy {


    public static void main(String[] args) throws Exception {

String url = "http://repo.typesafe.com";


URL server = new URL(url);

HttpURLConnection connection = (HttpURLConnection)server.openConnection();

connection.connect();

InputStream in = connection.getInputStream();


        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        byte[] buffer = new byte[1024];

        int readBytes = -1;


        while((readBytes = in.read(buffer)) > 1){

            baos.write(buffer,0,readBytes);

        }


        byte[] responseArray = baos.toByteArray();

System.out.println(new String(responseArray));


in.close();

    }

}



<사용법>



javac Proxy.javac


java -Dhttp.proxyHost=proxy.google.io -Dhttp.proxyPort=31281   -Dhttps.proxyHost=proxy. google.io  -Dhttps.proxyPort=31281     -Dhttp.nonProxyHosts="localhost|127.*|192.168.*|10.*|172.16.*|*.google.io"  Proxy


Posted by '김용환'
,



mysql에서 timestamp 컬럼을 추가할 때 주의할 점이 있다. 


timestamp 컬럼 그 자체로 타입을 정의하면, 밀리초(millisecond)는 나타나지 않는다.


timestamp(1)은  소수점 첫번째자리,

timestamp(2)는 소수점 두번째 자리를 표현한다.


그래서 최대 6자리 까지 정확도를 높일 수 있다.







https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html




MySQL 5.6.4 and up expands fractional seconds support for TIMEDATETIME, and TIMESTAMP values, with up to microseconds (6 digits) precision:

  • To define a column that includes a fractional seconds part, use the syntax type_name(fsp), where type_name is TIMEDATETIME, or TIMESTAMP, and fsp is the fractional seconds precision. For example:

    CREATE TABLE t1 (t TIME(3), dt DATETIME(6));

    The fsp value, if given, must be in the range 0 to 6. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. (This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.)

  • Inserting a TIMEDATE, or TIMESTAMP value with a fractional seconds part into a column of the same type but having fewer fractional digits results in rounding. Consider a table created and populated as follows:

    CREATE TABLE fractest( c1 TIME(2), c2 DATETIME(2), c3 TIMESTAMP(2) );
    INSERT INTO fractest VALUES
    ('17:51:04.777', '2018-09-08 17:51:04.777', '2018-09-08 17:51:04.777');

    The temporal values are inserted into the table with rounding:

    mysql> SELECT * FROM fractest;
    +-------------+------------------------+------------------------+
    | c1          | c2                     | c3                     |
    +-------------+------------------------+------------------------+
    | 17:51:04.78 | 2018-09-08 17:51:04.78 | 2018-09-08 17:51:04.78 |
    +-------------+------------------------+------------------------+


Posted by '김용환'
,




전세 들어가기 전에 반드시 등기부 등본(http://www.iros.go.kr/PMainJ.jsp)을 떼어봐야 한다.


대출 상황, 주인 인원 뿐 아니라, 주인의 성향을 알아볼 때 중요하다.


1. 대출이 많으면 계약하지 않는다.

-- 경매 조심.


2. 주인이 여러명인데, (계약자가 여러명) 계약일에 모두 나오지 않는다면 계약하지 않는다.

-- 주인이 서로 싸우는 경우일수도 있다..


3. 임차권 등기 명령이 있으면 절대 계약하지 않는다

-- 전세금을 주기 싫어하는 주인이다.




특히 임차권 등기 명령(전세금을 안줘서 임차인이 임대인에게 소송)이 등기부 등본에 담겨 있기에.. 


주인이 어떤 사람인지 알 수 있다.


참고 : http://slownews.kr/46707

Posted by '김용환'
,