usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [01/13] git commit: Make number of ElasticSearch shards and replicas configurable via usergrid props.
Date Fri, 31 Oct 2014 23:32:22 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/key-row-sharding 4082891a9 -> 400189e8d


Make number of ElasticSearch shards and replicas configurable via usergrid props.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/cb848d81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/cb848d81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/cb848d81

Branch: refs/heads/key-row-sharding
Commit: cb848d810d1bf095bb7108965b969c49a03cbfdd
Parents: 0bfca7e
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Thu Oct 30 14:02:58 2014 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Thu Oct 30 14:02:58 2014 -0400

----------------------------------------------------------------------
 .../src/main/resources/usergrid-default.properties      |  2 ++
 .../org/apache/usergrid/persistence/index/IndexFig.java | 12 ++++++++++++
 .../usergrid/persistence/index/impl/EsProvider.java     |  2 ++
 3 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb848d81/stack/config/src/main/resources/usergrid-default.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/main/resources/usergrid-default.properties b/stack/config/src/main/resources/usergrid-default.properties
index fb043d4..43e3920 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -59,6 +59,8 @@ elasticsearch.cluster_name=elasticsearch
 elasticsearch.index_prefix=usergrid
 elasticsearch.hosts=127.0.0.1
 elasticsearch.port=9300
+elasticsearch.number_shards=1
+elasticsearch.number_replicas=1
 
 index.query.limit.default=1000
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb848d81/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index 142c48a..e2ab857 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -39,6 +39,10 @@ public interface IndexFig extends GuicyFig {
 
     public static final String ELASTICSEARCH_STARTUP = "elasticsearch.startup";
 
+    public static final String ELASTICSEARCH_NUMBER_OF_SHARDS = "elasticsearch.number_shards";
+
+    public static final String ELASTICSEARCH_NUMBER_OF_REPLICAS = "elasticsearch.number_replicas";
+
     public static final String QUERY_CURSOR_TIMEOUT_MINUTES = "elasticsearch.cursor_timeout.minutes";
 
     public static final String ELASTICSEARCH_FORCE_REFRESH = "elasticsearch.force_refresh";
@@ -82,4 +86,12 @@ public interface IndexFig extends GuicyFig {
     @Default("default")
     @Key( ELASTICSEARCH_NODENAME )
     public String getNodeName();
+
+    @Default("1") 
+    @Key( ELASTICSEARCH_NUMBER_OF_SHARDS )
+    public int getNumberOfShards();
+
+    @Default("1")
+    @Key( ELASTICSEARCH_NUMBER_OF_REPLICAS )
+    public int numberOfReplicas();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb848d81/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
index efc61a9..a353b43 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
@@ -161,6 +161,8 @@ public class EsProvider {
 
                     .put( "client.transport.ping_timeout", 2000 ) // milliseconds
                     .put( "client.transport.nodes_sampler_interval", 100 )
+                    .put("index.number_of_shards", fig.getNumberOfShards() )
+                    .put("index.number_of_replicas", fig.numberOfReplicas() )
                     .put( "network.tcp.blocking", true )
                     .put( "node.client", true )
                     .put( "node.name", nodeName )


Mime
View raw message