I am running an elastic search version 4.1 on windows 8. I tried to index a document through java. When running a JUNIT test the error appears as below.
我在windows 8上运行了一个弹性搜索版4.1。我试图通过java索引文档。运行JUNIT测试时,错误如下所示。
org.elasticsearch.action.UnavailableShardsException: [wms][3] Primary shard is not active or isn't assigned is a known node. Timeout: [1m], request: index {[wms][video][AUpdb-bMQ3rfSDgdctGY], source[{
"fleetNumber": "45",
"timestamp": "1245657888",
"geoTag": "73.0012312,-123.00909",
"videoName": "timestamp.mjpeg",
"content": "ASD123124NMMM"
}]}
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.retryBecauseUnavailable(TransportShardReplicationOperationAction.java:784)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.doStart(TransportShardReplicationOperationAction.java:402)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$3.onTimeout(TransportShardReplicationOperationAction.java:500)
at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:239)
at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:497)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
I can not figure out, why causes this error to happen. When a delete data or index it works fine. What might be the possible cause of it.
我搞不懂为什么会发生这样的错误。当删除数据或索引时,它可以正常工作。可能的原因是什么。
2 个解决方案
#1
16
you should look at that link: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-allocation.html
您应该查看这个链接:http://www.elastic search.org/guide/en/elasticity search/reference/current/index-modules- alloc.html
and that part in particular:
特别是这一部分:
cluster.routing.allocation.disk.watermark.low controls the low watermark for disk usage. It defaults to 85%, meaning ES will not allocate new shards to nodes once they have more than 85% disk used. It can also be set to an absolute byte value (like 500mb) to prevent ES from allocating shards if less than the configured amount of space is available.
cluster.routing.allocation.disk.watermark。低控制低水印的磁盘使用。它默认为85%,这意味着一旦使用了超过85%的磁盘,ES将不会将新的碎片分配给节点。它还可以设置为一个绝对字节值(比如500mb),以防止ES在可用空间少于配置的情况下分配碎片。
cluster.routing.allocation.disk.watermark.high controls the high watermark. It defaults to 90%, meaning ES will attempt to relocate shards to another node if the node disk usage rises above 90%. It can also be set to an absolute byte value (similar to the low watermark) to relocate shards once less than the configured amount of space is available on the node.
cluster.routing.allocation.disk.watermark。高控制高水印。它默认为90%,这意味着如果节点磁盘使用率超过90%,ES将尝试将碎片重新定位到另一个节点。还可以将其设置为一个绝对字节值(类似于低水印),以便在节点上重新定位小于配置的空间量的碎片。
#2
0
In my case the culprit was port 9300. It was blocked.
在我看来,罪魁祸首是9300港口。这是屏蔽。
Elasticsearch will bind to a single port for both HTTP and the node/transport APIs.
Elasticsearch将绑定到单个端口,用于HTTP和节点/传输api。
It'll try the lowest available port first, and if it is already taken, try the next. If you run a single node on your machine, it'll only bind to 9200 and 9300.
它将首先尝试最低可用的端口,如果已经使用了,请尝试下一个。如果您在机器上运行一个节点,它将只绑定到9200和9300。
So I unblocked port 9300 and I was good to go.
所以我打开了9300端口,我很好。
In REDHAT linux to unblock a port.
在REDHAT linux中,打开一个端口。
sudo firewall-cmd --zone=public --add-port=9300/tcp --permanent
sudo firewall-cmd --reload
sudo iptables-save | grep 9300
#1
16
you should look at that link: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-allocation.html
您应该查看这个链接:http://www.elastic search.org/guide/en/elasticity search/reference/current/index-modules- alloc.html
and that part in particular:
特别是这一部分:
cluster.routing.allocation.disk.watermark.low controls the low watermark for disk usage. It defaults to 85%, meaning ES will not allocate new shards to nodes once they have more than 85% disk used. It can also be set to an absolute byte value (like 500mb) to prevent ES from allocating shards if less than the configured amount of space is available.
cluster.routing.allocation.disk.watermark。低控制低水印的磁盘使用。它默认为85%,这意味着一旦使用了超过85%的磁盘,ES将不会将新的碎片分配给节点。它还可以设置为一个绝对字节值(比如500mb),以防止ES在可用空间少于配置的情况下分配碎片。
cluster.routing.allocation.disk.watermark.high controls the high watermark. It defaults to 90%, meaning ES will attempt to relocate shards to another node if the node disk usage rises above 90%. It can also be set to an absolute byte value (similar to the low watermark) to relocate shards once less than the configured amount of space is available on the node.
cluster.routing.allocation.disk.watermark。高控制高水印。它默认为90%,这意味着如果节点磁盘使用率超过90%,ES将尝试将碎片重新定位到另一个节点。还可以将其设置为一个绝对字节值(类似于低水印),以便在节点上重新定位小于配置的空间量的碎片。
#2
0
In my case the culprit was port 9300. It was blocked.
在我看来,罪魁祸首是9300港口。这是屏蔽。
Elasticsearch will bind to a single port for both HTTP and the node/transport APIs.
Elasticsearch将绑定到单个端口,用于HTTP和节点/传输api。
It'll try the lowest available port first, and if it is already taken, try the next. If you run a single node on your machine, it'll only bind to 9200 and 9300.
它将首先尝试最低可用的端口,如果已经使用了,请尝试下一个。如果您在机器上运行一个节点,它将只绑定到9200和9300。
So I unblocked port 9300 and I was good to go.
所以我打开了9300端口,我很好。
In REDHAT linux to unblock a port.
在REDHAT linux中,打开一个端口。
sudo firewall-cmd --zone=public --add-port=9300/tcp --permanent
sudo firewall-cmd --reload
sudo iptables-save | grep 9300