우버(uber)에서 apache flink와 apache calcite 기반으로 SQL 기반의 스트리밍 분석 플랫폼(athenaX)을 내어놓았다.


https://eng.uber.com/athenax/


https://github.com/uber/AthenaX







잼난 부분을 소개하면 다음과 같다.


우버 개발자가 apache flink에 윈도우 관련 내용과 complex 타입을 지원하도록 PR을 보냈다. 기여했다.

https://issues.apache.org/jira/browse/FLINK-6377

https://github.com/apache/flink/pull/3665










기타 : 볼만한 내용


https://data-artisans.com/blog/session-windowing-in-flink



Streaming SQL from Julian Hyde




Introduction to Apache Calcite from Jordan Halterman




apache phoenix에서 apche calcite로 넘어가는 일은 얼마 안남은 듯.. 

Posted by '김용환'
,

java8 stream 사용시 주의할 점을 작성한 좋은 블로그 내용이 있어서 링크를 건다.



https://blog.jooq.org/2014/06/13/java-8-friday-10-subtle-mistakes-when-using-the-streams-api/



이 내용을 이용진 블로거님이 번역한 블로그이다.


http://leeyongjin.tistory.com/entry/Java8-%EC%9E%90%EB%B0%948-Stream-API-%EC%A3%BC%EC%9D%98%EC%82%AC%ED%95%AD


Posted by '김용환'
,


VM 생성 때 못한 작업에 대한 후처리

1) youtube cloud init example


2) documentation

Automating Openstack with cloud init run a script on VM's first boot


https://raymii.org/s/tutorials/Automating_Openstack_with_Cloud_init_run_a_script_on_VMs_first_boot.html




3) example


https://arnesund.com/2015/02/05/how-to-use-cloud-init-to-customize-new-openstack-vms/

Posted by '김용환'
,



https://platform9.com/blog/kubernetes-vs-mesos-marathon/





Kubernetes offers significant advantages over Mesos + Marathon for three reasons:

  • Much wider adoption by the DevOps and containers community
  • Better scheduling options for pods, useful for complex application stacks
  • Based on over a decade of experience at Google

However, Kubernetes has been known to be difficult to deploy and manage. Platform9’s Managed Kubernetes product can fill this gap by letting organizations focus on deploying microservices on Kubernetes, instead of managing and upgrading a highly available Kubernetes deployment themselves. Further details on these and other deployment models for Kubernetes can be found in The Ultimate Guide to Deploy Kubernetes.

Posted by '김용환'
,


elasticsearch에 보면 json 출력을 예쁘게 (&pretty) 할 수 있다.



만약 url을 통해 들어오는 json이라면 python을 활용해 예쁘게 출력할 수 있다. 



echo '{"url":"http:\/\/search.google.com\/api/v2/keyword", "param":"abc"}' | python -mjson.tool

{

    "url": "http://search.google.com/api/v2/keyword",

    "param": "abc"

}




Posted by '김용환'
,


Apache Phoenix 드라이버를 사용할 때 유의할 사항이 있다. 

play2의 db에서는 jdbc url에 매개변수(또는 configuration)을 추가할 수 없다. 즉 DriverManager.getConnection("..", props)에서 props에 관련 설정을 추가해야 한다. 



아래와 같은 방식은 사용할 수 없다. 

db {
default.driver = org.apache.phoenix.jdbc.PhoenixDriver
default.url = "jdbc:phoenix:hbase-md15b1-031.dakao.io:8765/kemi;phoenix.schema.isNamespaceMappingEnable=true;phoenix.functions.allowUserDefinedFunctions=true"
default.logSql = true
default.username = ""
default.password = ""
}


문서를 잘 보면. 덜 개발되었다..




참고 https://phoenix.apache.org


Use JDBC to get a connection to an HBase cluster like this:

Connection conn = DriverManager.getConnection("jdbc:phoenix:server1,server2:3333",props);

where props are optional properties which may include Phoenix and HBase configuration properties, and the connection string which is composed of:

jdbc:phoenix [ :<zookeeper quorum> [ :<port number> [ :<root node> [ :<principal> [ :<keytab file> ] ] ] ] ] 





아래와 같이 사용해야 한다. 


Properties props = new Properties();

props.setProperty("phoenix.schema.isNamespaceMappingEnabled", "true");

props.setProperty("phoenix.functions.allowUserDefinedFunctions", "true");

connection = DriverManager.getConnection("jdbc:phoenix:...", props);





또한 sbt 또한 문제가 있다.  sbt에서 apache phoenix 드라이버를 사용하기 위해 lib, guava 이슈를 해결해야 한다. 얼추 해결되더라도 추후 runtime 이슈가 생길 수 있다. 




사례 1

Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at org.apache.phoenix.query.ConfigurationFactory$ConfigurationFactoryImpl$1.call(ConfigurationFactory.java:49)

at org.apache.phoenix.query.ConfigurationFactory$ConfigurationFactoryImpl$1.call(ConfigurationFactory.java:46)

at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)

at org.apache.phoenix.util.PhoenixContextExecutor.callWithoutPropagation(PhoenixContextExecutor.java:91)

at org.apache.phoenix.query.ConfigurationFactory$ConfigurationFactoryImpl.getConfiguration(ConfigurationFactory.java:46)

at org.apache.phoenix.jdbc.PhoenixDriver.initializeConnectionCache(PhoenixDriver.java:151)

at org.apache.phoenix.jdbc.PhoenixDriver.<init>(PhoenixDriver.java:142)




resolvers += "Cloudera Repository" at "https://repository.cloudera.com/artifactory/cloudera-repos/"


libraryDependencies ++= Seq(
"org.apache.hbase" % "hbase" % "1.2.6",
"org.apache.hbase" % "hbase-common" % "1.2.6",
"org.apache.hbase" % "hbase-client" % "1.2.6",
"org.apache.hbase" % "hbase-server" % "1.2.6", "org.apache.phoenix" % "phoenix-core" % "4.11.0-HBase-1.2",

..)



사례 2



 org.apache.hadoop.hbase.DoNotRetryIOException: java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator



libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "13.0.1" force(),
"org.apache.hbase" % "hbase" % "1.2.6",
"org.apache.hbase" % "hbase-common" % "1.2.6",
"org.apache.hbase" % "hbase-client" % "1.2.6",
"org.apache.hbase" % "hbase-server" % "1.2.6",
"org.apache.phoenix" % "phoenix-core" % "4.11.0-HBase-1.2")



결론은 apache phoenix를 연동하기 위해 play2-sbt를 사용하는 것은 조금 귀찮을 수 있다..


scala를 쓰려면 무거운 play2보다는 경량 프레임워크를 사용하고 내가 db 모듈을 만드는 게 나을 수도.. 

Posted by '김용환'
,


https://www.playframework.com/documentation/2.6.x/api/java/play/db/Database.html 문서에는 있는데.


play.db.Database를 import하려고 하려면 에러가 난다.


import play.db._



libraryDependencies += jdbc 를 추가하면 된다. 기본적으로 추가가 되어 있지 않다.. 

Posted by '김용환'
,



sbt는 스칼라 컴파일 툴이다.

의존성을 추가할 때 

%%를 사용하면 버전을 artifact 뒤에 추가한다. 스칼라는 아직 하위 호환성보다는 잘 만들어질 언어를 지향하기 때문인데..


그러나 자바 라이브러리를 쓰기 위해 %%를 하면 에러가 발생한다. 그 것은 자바는 버전 별로 라이브러리를 만들지 않기 때문이다. 



sbt.librarymanagement.ResolveException: unresolved dependency: org.apache.phoenix#phoenix-core_2.11;4.11.0-HBase-1.2: not found




scala lib은 %%를

java lib은 %를 사용하는 것에 익숙해질 필요가 있다. ㅠ(맨날 틀림.)

libraryDependencies ++= Seq(guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.1" % "test",
"org.apache.phoenix" % "phoenix-core" % "4.11.0-HBase-1.2")


Posted by '김용환'
,


요즘 뜨고 있는 java REST 테스트 관련 라이브러리 중에 https://github.com/rest-assured/rest-assured이 있다.


자바에서는 구조적으로 REST 호출과 결과 테스트(특히 json)를 하려면 지저분한 코드(map, list)를 써야 한다.

rest-assured는 이를 쉽게 테스트해줄 수 있다. 



http://localhost:8080/lotto


{
"lotto":{
 "lottoId":5,
 "winning-numbers":[2,45,34,23,7,5,3],
 "winners":[{
   "winnerId":23,
   "numbers":[2,45,34,23,3,5]
 },{
   "winnerId":54,
   "numbers":[52,3,12,11,18,22]
 }]
}
}




테스트 코드는 다음과 같다. 써봐야 할듯 ㅎㅎ


get("/lotto").then().body("lotto.lottoId", equalTo(5));



get("/lotto").then().body("lotto.winners.winnerId", hasItems(23, 54));




Posted by '김용환'
,


intellij에서 sbt 컴파일 중에 에러가 발생했다. 


[error] java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: sbt/internal/librarymanagement/GetClassifiersModule



최신 버전으로 intellij를 업데이트하면 문제가 해결된다.

Posted by '김용환'
,