我的群集不在同一个网络中,我的电脑和服务器之间有一条隧道。
我有这个错误:
org.elasticsearch.client.transport.NoNodeAvailableException:没有配置的节点可用
答案 0 :(得分:0)
如果使用elasticsearch默认多播机制来发现群集中的节点,则必须将所有群集节点都放在同一子网上(直到版本2.0为止)。 为了让您的节点发现群集中的其他节点,您可以配置[elasticsearch home] /config/elasticsearch.yaml字段名称:discovery.zen.ping.unicast.hosts,如[here]所述 (https://www.elastic.co/guide/en/elasticsearch/reference/2.x/modules-network.html):
discovery.zen.ping.unicast.hosts
要加入群集,节点需要知道群集中至少某些其他节点的主机名或IP地址。该>设置提供该节点将尝试联系的其他节点的初始列表。接受IP地址或主机名。
默认为[" 127.0.0.1"," [:: 1]"]。
希望它有所帮助。
答案 1 :(得分:0)
我尝试在我的环境中重新创建配置,并设法使用Elasticsearch(创建索引)。这是怎么回事:
public class App
{
public static void main( String[] args ) throws Exception
{
Settings settings = ImmutableSettings.settingsBuilder().
put("cluster.name", "my-cluster").build();
TransportClient client = new TransportClient(settings)
.addTransportAddress(
new InetSocketTransportAddress(
"localhost", 9093));
CreateIndexResponse rs = client.admin().indices().create(new CreateIndexRequest("tunnelingindex")).actionGet();
System.out.println(rs.isAcknowledged());
client.close();
}
}
代码创建一个名为tunnelingindex
的索引
如果它仍然不适合您,我认为您可能遇到与隧道或Elasticsearch无关的问题。
希望我能帮到你。
答案 2 :(得分:0)