Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All shards are placed to the first node #24

Open
avlukanin opened this issue Jun 17, 2016 · 3 comments
Open

All shards are placed to the first node #24

avlukanin opened this issue Jun 17, 2016 · 3 comments
Labels

Comments

@avlukanin
Copy link

avlukanin commented Jun 17, 2016

I used the default settings, so 3 nodes are created. After this command:

runner.createIndex("test_index", Settings.builder().build());

I see that the data/node_1/elasticsearch-cluster-runner/nodes/0/indices/test_index folder has all the shards folders, but data/node_2/elasticsearch-cluster-runner/nodes/0/ and data/node_2/elasticsearch-cluster-runner/nodes/0/ folders has no indices subfolder at all.

If I add these settings:

cluster.routing.allocation.total_shards_per_node: 1
index.number_of_shards: 3
index.number_of_replicas: 0

I get this exception:

org.codelibs.elasticsearch.runner.ClusterRunnerException: ensureYellow timed out, cluster state:

version: 5
state uuid: 0tU2XEO6SeagUQEIui6JRg
from_diff: false
meta data version: 3
nodes: 
   {Node 1}{HLJ9sxVTR2OlxA321H1n2Q}{127.0.0.1}{127.0.0.1:9301}{master=true}, local, master
routing_table (version 3):
-- index [test_index]
----shard_id [test_index][0]
--------[test_index][0], node[HLJ9sxVTR2OlxA321H1n2Q], [P], v[2], s[STARTED], a[id=ye9MxH2LRNeCif-c_G8-CQ]
----shard_id [test_index][1]
--------[test_index][1], node[null], [P], v[0], s[UNASSIGNED], unassigned_info[[reason=INDEX_CREATED], at[2016-06-17T09:28:15.461Z]]
----shard_id [test_index][2]
--------[test_index][2], node[null], [P], v[0], s[UNASSIGNED], unassigned_info[[reason=INDEX_CREATED], at[2016-06-17T09:28:15.461Z]]

routing_nodes:
-----node_id[HLJ9sxVTR2OlxA321H1n2Q][V]
--------[test_index][0], node[HLJ9sxVTR2OlxA321H1n2Q], [P], v[2], s[STARTED], a[id=ye9MxH2LRNeCif-c_G8-CQ]
---- unassigned
--------[test_index][1], node[null], [P], v[0], s[UNASSIGNED], unassigned_info[[reason=INDEX_CREATED], at[2016-06-17T09:28:15.461Z]]
--------[test_index][2], node[null], [P], v[0], s[UNASSIGNED], unassigned_info[[reason=INDEX_CREATED], at[2016-06-17T09:28:15.461Z]]

If I download Elasticsearch 2.3.3, run 3 nodes and add an index, all 3 shards are allocated evenly at 3 nodes.

I also tried to download elasticsearch-cluster-runner, update dependency to 2.3.3 and run the test with the updated version. The same bug.

@avlukanin
Copy link
Author

I've copied these settings from your test code and now the index is splitted evenly:

                settingsBuilder.put("http.cors.enabled", true);
                settingsBuilder.put("http.cors.allow-origin", "*");
                settingsBuilder.putArray("discovery.zen.ping.unicast.hosts", "localhost:9301-9305");

@avlukanin
Copy link
Author

So, it is better to add these settings automatically if more than one shard is added to the cluster. I wonder why standalone Elasticsearch does not require these settings? Because it assigns ports automatically?

@marevol
Copy link
Contributor

marevol commented Jul 28, 2016

Our plugin sets transport.tcp.port to specific port(9301-9303) for 3 nodes,
but standalone elasticsearch uses 9300-9400(range).
I think it's difficult to change the default value of our plugin
because the plugin manages an available port for transport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants