[ElasticSearch] 색인 성능..
Elastic/Elasticsearch 2014. 7. 15. 14:36장비 : 32 코어, 64G, 6대
파일 크기 : 8.5GB
문서 수 : 66,661,310개
문서 당 : 100개 이상 필드에 20개 이상 색인(not_analyzed) 필드의 경우..
노드당 : 초당 26,453개 색인.
총 색인 시간 : 7분
'Elastic'에 해당되는 글 498건
[ElasticSearch] 색인 성능..Elastic/Elasticsearch 2014. 7. 15. 14:36장비 : 32 코어, 64G, 6대 파일 크기 : 8.5GB 문서 수 : 66,661,310개 문서 당 : 100개 이상 필드에 20개 이상 색인(not_analyzed) 필드의 경우.. 노드당 : 초당 26,453개 색인. 총 색인 시간 : 7분 [ElasticSearch] shard allocation 설정.Elastic/Elasticsearch 2014. 7. 2. 17:36shard rebalancing 제어하기 위해... curl -XPUT localhost:19200/_cluster/settings -d '{ "persistent" : { "cluster.routing.allocation.enable" : "none" } }' curl -XPUT localhost:19200/_cluster/settings -d '{ "persistent" : { "index.routing.allocation.enable" : "none" } }' [Elasticsearch] mapping type 템플릿 (numeric, string, date)Elastic/Elasticsearch 2014. 7. 2. 15:49# numeric type "" : {"type" : "long", "store" : "no", "index" : "not_analyzed", "index_options" : "docs", "ignore_malformed" : true, "include_in_all" : false}, "" : {"type" : "long", "store" : "yes", "index" : "no", "index_options" : "docs", "ignore_malformed" : true, "include_in_all" : false}, # date type "" : {"type" : "date", "format" : "yyyyMMddHHmmss", "store" : "no", "index" : "not_analyzed", "index_options" : "docs", "ignore_malformed" : true, "include_in_all" : false}, "" : {"type" : "date", "format" : "yyyyMMddHHmmss", "store" : "yes", "index" : "no", "index_options" : "docs", "ignore_malformed" : true, "include_in_all" : false}, # string type "" : {"type" : "string", "store" : "no", "index" : "not_analyzed", "norms": {"enabled" : false}, "index_options" : "docs", "include_in_all" : false},
"" : {"type" : "string", "store" : "yes", "index" : "no", "include_in_all" : false}, [Elasticsearch] aggregations 사용 시 filter 의 차이점.Elastic/Elasticsearch 2014. 6. 18. 11:32알고 있는 내용도 다시 짚고 넣어 갑시다. ^^ 우선 aggregation 이 궁금하신 분들은 꼭 필독하시기 바랍니다. http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/aggregations.html 데이터가 많아도 분석을 어떻게 할지 몰라서는 그냥 쓰레기에 불과 하지 않겠죠. aggregations 사용 시 filter 사용에 대한 주의 사항입니다. 원문에서 그대로 가져왔습니다. Choosing the appropriate type of filtering — search hits, aggregations or both — often boils down to how you want your user interface to behave. Choose the appropriate filter (or combinations) depending on how you want to display results to your user.
지난 번 buzz 에서 발표되었던 내용에 대해서도 살짝 언급 했었죠. query vs filter 에 대한 차이점에 대해서... 역시 aggregations 에서도 filter 사용은 주의해서 사용을 해야 겠내요. [Elasticsearch] JDBC River 알아보기.Elastic/Elasticsearch 2014. 6. 13. 18:25금요일 퇴근 시간이 얼마 안남은 관계로 짧게 쓰겠습니다.
원문 : https://github.com/jprante/elasticsearch-river-jdbc [설치방법] # installation # river install https://github.com/jprante/elasticsearch-river-jdbc bin/plugin --install jdbc --url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/1.2.1.1/elasticsearch-river-jdbc-1.2.1.1-plugin.zip # mysql jdbc driver install curl http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.31.tar.gz curl -o mysql-connector-java-5.1.31.zip -L 'http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.31.zip/from/http://cdn.mysql.com/' # plugins/jdbc/ 아래로 mysql connector jar 파일 저장. mv ./mysql-connector-java-5.1.31/mysql-connector-java-5.1.31-bin.jar . 제가 작성한건 약식이니까 원문 참고하셔서 설치 하시기 바랍니다. 그리고 저는 mysql 로 테스트 하였습니다. (뭐 다른 DBMS도 크게 다르지는 않습니다.) [River 등록] # river register curl -XPUT 'localhost:9200/_river/jdbc_mysql/_meta' -d '{ "type" : "jdbc", "jdbc" : { "url" : "jdbc:mysql://localhost:3306/test", "user" : "root", "password" : "", "sql" : "SELECT item_id, item_code, item_name, price, regdate FROM TBL_ITEM_INCREMEN WHERE ts BETWEEN NOW() - 30 AND NOW() ANd fetch_flag = 'F'", "index" : "river_jdbc_mysql", # default jdbc "type" : "tbl_item_increment", # default jdbc "strategy" : "simple", "schedule" : null, "cronpoolsize" : 4, "rounding" : null, "scale" : 2, "ignore_null" : false, "autocommit" : false, "fetchsize" : 10, /* Integer.MIN for MySQL */ "max_rows" : 0, "max_retries" : 3, "max_retries_wait" : "30s", "locale" : Locale.getDefault().toLanguageTag(), "timezone" : TimeZone.getDefault(), "index_settings" : null, "type_mapping" : null, "maxbulkactions" : 1000, "maxconcurrentbulkactions" : 4 * available CPU cores, } }' 등록방법에는 원문에 나와 있는 default value 들을 보기 위해 몽땅 다 넣어 두었습니다. 그렇기 때문에 이건 목적에 맞게 수정해서 사용하시기 바랍니다. [River 등록 - fetch/update] curl -XPUT 'localhost:9200/_river/jdbc_mysql_fetch/_meta' -d '{
"type" : "jdbc", "jdbc" : { "url" : "jdbc:mysql://localhost:3306/test", "user" : "root", "password" : "", "sql" : [ { "statement" : "SELECT item_id, item_code, item_name, price, regdate FROM TBL_ITEM_INCREMENT WHERE fetch_flag = ?", "parameter" : ["F"], "callable" : false }, { "statement" : "UPDATE TBL_ITEM_INCREMENT SET fetch_flag = ? WHERE ts < NOW() - ? ANd fetch_flag = ?", "parameter" : ["T", 180, "F"], "callable" : false
} ], "index" : "river_jdbc_mysql", "type" : "tbl_item_increment", "schedule" : "0 * * ? * *", "maxconcurrentbulkactions" : 32 } }' 저는 테스트로 색인해야할 데이터를 fetch 하는 쿼리와 색인 작업이 완료된 데이터를 다시 fetch해 오지 않도록 flag 를 update 하는 쿼리를 두 개 등록해서 테스트 하였습니다. [느낀점] - 음... 대용량 데이터에 대한 처리 시 과연 요구하는 성능이 나올까???? - 그냥 특성에 맞는 서비스에 적용하면 아주 편리 할 것 같기는 하다. [테스트 환경] - elasticsearch 1.2.1 : standalone, cluster - elasticsearch-river-jdbc 1.2.1.1 - mysql 5.6.11 - mysql connector 5.1.31 [Elasticsearch] qeuries, filters 에 대해..Elastic/Elasticsearch 2014. 6. 10. 14:29제 블로그 어디엔가 적었던것 같은데 쓰고도 찾지를 못하겠내요.. ㅡ.ㅡ;; 공유한 적이 있는지 없는지 기억이 안나서 그냥 다시 써 봅니다. (치매 방지를 위해서... ㅎㅎ) berlin buzz words 에서 clinton gormley 가 발표한 자료에 있는 내용입니다. 여기에 살짝 살만 붙혔습니다. [Queries] - relevance - full text - not cached - slower [Filters] - boolean yes/no - exact values - cached - faster 이 둘의 차이는 특성에 맞춰서 사용을 하셔야 합니다. 즉, 검색하고자 하는 문서들에 대한 ranking 이나 relevance document 의 결과를 얻고자 한다면 filter 를 먼저 사용하시면 안됩니다. 일반적인 웹문서 검색이나 쇼핑 상품 검색 같은 곳에서는 사용할 수 없겠죠. - 결과에 relevant _score 가 반영 되어 있습니다. filters 를 이용해서 사용하기 좋은 형태는 로그성 데이터 입니다. 즉, 문서간의 relevance 를 고려하지 않아도 되는 그런 문서에 적합합니다. 또한 성능도 훨씬 빠르겠죠. - 결과에 relevant _score 가 반영 되어 있지 않습니다. 분석 및 통계에 활용하고자 한다면 query 보다 filter를 이용해 구현 하면 성능 향상에 도움을 받으실 수 있으니 참고 하시면 좋겠습니다. [Elasticsearch] Elasticsearch Hadoop Plugin 2.0 GA 테스트.Elastic/Elasticsearch 2014. 5. 29. 12:42http://www.elasticsearch.org/blog/es-hadoop-2-0-g/ hadoop plugin 2.0 정식 버전이 나왔습니다. 1.3.0 까지 테스트는 했었는데, 2.0 은 어제, 오늘 테스트를 끝냈내요. 일단 2.0 에서는 json 지원이 되어서 편하내요. MR 로 indexer, searcher 를 만들어서 돌려봤는데 indexer 의 경우 hadoop 에 저장되어 있는 데이터를 es 로 색인 할 수 있어서 데이터 분석에 활용 하면 아주 좋을 것 같습니다. 그리고 searcher 의 경우 EsInputFormat.class 에서 보면 내부적으로 scroll query 를 사용하기 때문에 뭘로 활용할지 아직 고민이기는 합니다. 더군다나 이게 hadoop 데이터를 검색 하거나 읽는 기능이 아니고 그냥 mr 로 es 로 검색 질의 하는 거라서 더욱 활용 범위가 애매 하내요. 샘플 코드들은 아래 링크에 있습니다. https://github.com/elasticsearch/elasticsearch-hadoop [Elasticsearch] Cluster Status - green, yellow, redElastic/Elasticsearch 2014. 5. 19. 11:425월에는 elasticsearch 관련 글을 하나도 못 올렸내요. 그래서 혹시 궁금해 하시는 분들을 위해서 elasticsearch 에서 보여 주고 있는 green, yellow, red 가 어떻게 정해 지는지 공유해 드리려 합니다. Elasticsearch 에서는 세 가지의 Cluster status 를 갖습니다. [ClusterHealthStatus.java] 1. Green 2. Yellow 3. Red Green 은 뭐 다 아시겠죠. 정상 모든 index 와 shard 가 정상일 때 green 값을 갖습니다. 그럼 yellow 와 red 는 어떤 경우에 설정이 될까요? [ClusterIndexHealth.java] 여기 보시면 이해 하실 수 있으실 겁니다. RED) - primary shard 가 active 가 아닐 경우. - shard health 가 red 일 경우. - index 에 대한 shard 가 empty 일 경우. (즉, index 가 아직 생성되지 않았을 경우) YELLOW) - active shard size 와 shard routing table 의 shard size 가 다를 경우. - unassigned shard 가 존재 할 경우. - initializing shard 가 존재 할 경우.
이게 별 내용은 아닐 수 있지만, 관리자나 운영자 분들 한테 설명을 하기 위해서는 꼭 알아야 할 내용이라고 생각 합니다. 도움이 되셨으면 하내요. :) [Elasticsearch] lucene arirang analyzer plugin.Elastic/Elasticsearch 2014. 4. 30. 18:37http://jjeong.tistory.com/957 글에 이은 루씬 한국어 형태소 분석기 플러그인 입니다. 일단 잘되내요.. ^^; 형태소 분석기 플러그인 만드는 방법은 아래 글 참고하세요. http://jjeong.tistory.com/818 https://github.com/HowookJeong/elasticsearch-analysis-arirang [lucene] arirang maven build 하기.Elastic/Elasticsearch 2014. 4. 30. 15:26elasticsearch 에 한글형태소 분석기로 arirang 을 적용해 보려고 합니다. 그 전에 먼저 arirang 을 받아서 빌드 테스트를 해보고 lucene 4.7.2 로 빌드가 잘 되면 elasticsearch 1.1.1 용 플러그인으로 만들것입니다. 자세한 내용은 카페에서 확인하세요. http://cafe.naver.com/korlucene - SVN https://lucenekorean.svn.sourceforge.net/svnroot/lucenekorean - Build 조건 Maven 3.x JDK 1.7 저는 그냥 https://lucenekorean.svn.sourceforge.net/svnroot/lucenekorean/arirang.lucene-analyzer-4.6 받아서 4.7.2 로 수정해서 빌드 했습니다. @수명님이 주의 사항을 카페에 올려 두신게 있는데요 arirang.morph 먼저 빌드 하신 후 analyzer 를 빌드 하셔야 합니다. 이건 pom.xml 열어 보시면 아실듯.. 일단 4.7.2 로 빌드 잘 되내요. 플러그인 적용 방법은 따로 공유 드리겠습니다. 다 아시는 분들에게는 별로 도움도 안되겠내요.. ^^;; |