Elastic Search Donner une erreur Ne vivant nœuds trouvés dans votre cluster

Je suis de commencer à travailler avec elastic search.J'ai réussi à installer elastic search sur mon serveur(Différent du serveur d'application).Mais Quand j'essaie d'appeler Elatic de recherche à partir de mon Application serveur, il donne une erreur
Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\NoNodesAvailableException' with message 'No alive nodes found in your cluster'

Quand je vérifie Elastic search état il montre Active.

Comment puis-je appeler élastique de recherche à partir de mon serveur d'Application pour mon Elastic search server.

<?php
    require 'vendor/autoload.php';
    $hosts = [
       'ip_address:9200'         //IP + Port
    ];
    $client = Elasticsearch\ClientBuilder::create()->setHosts($hosts)->build();

    $params = [
        'index' => 'my_index',
        'type' => 'my_type',
        'id' => 'my_id',
        'body' => ['testField' => 'abc']
    ];

    $response = $client->index($params);
?>

Mon elasticsearch.yml Paramètres

    # ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.memory_lock: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 0.0.0.0
#network.bind_host: 0
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes /2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true

elasticsearch.yml paramètres qui ne sont pas de travail

network.host: 127.0.0.1

network.host: 0

network.host: 0.0.0.0

network.host: IP_Address

network.bind_host: 0

network.bind_host: IP_Address

Lorsque j'ai mis les paramètres ci-dessus, puis elasticsearch montre l'échec de l'état.

REMARQUE : Elastic search installer sur un autre serveur à partir de mon serveur d'Applications.

  • avez-vous ajouté network.bind_host: 0 dans votre fichier de configuration pour activer l'écoute de l'autre que localhost?
  • essayez d'ajouter network.bind_host: IP_of_your_elastic_search_server dans elasticsearch.yml ,redémarrez élastique service de recherche et d'essai ip:9200 à partir de votre serveur d'applications
  • Sir lorsque j'ai mis en réseau.bind_host: 0 OU réseau.bind_host: IP_of_your_elastic_search_server et de vérifier ensuite elasticsearch état de son spectacle a Échoué.Lorsque j'ai fait un commentaire "#réseau.bind_host: 0" alors que son spectacle Active.
  • arrêter elasticsearch service, ajouter network.host: 0.0.0.0 de service de démarrage de nouveau.
  • et n'oubliez pas de mettre votre elsaticsearch ip du serveur dans le $hosts = ['ip_address:9200']; tableau
  • Actuel elasticsearch.yml Paramètres réseau.hôte: 0.0.0.0 réseau.bind_host: IP_ ADRESSE Elastic Search État Chargé: chargé (/usr/lib/systemd/system/elasticsearch.service; handicapés; fournisseur de préréglage: activé) Active: échec (Résultat: exit-code) depuis Thu 2017-03-02 08:37:28 UTC; 1min 48s il ya Docs: élastique.co
  • veuillez supprimer network.bind_host: IP_ ADDRESS
  • commentaire de réseau.bind_host: IP_ ADRESSE.Mais même résultat. d'état a Échoué.
  • partager vos elasticsearch.yml fichier
  • cluster.nom: mon-nœud d'application.nom: node-1 # nœud.rack: r1 # chemin d'accès.journaux: /chemin/vers/logs # bootstrap.memory_lock: véritable réseau.hôte: 0.0.0.0 #réseau.bind_host: 0 # http.port: 9200 # découverte.zen.ping.unicast.hôtes: ["host1", "host2"] # découverte.zen.minimum_master_nodes: 3 # la passerelle.recover_after_nodes: 3 n ° de nœud.max_local_storage_nodes: 1 n ° de l'action.destructive_requires_name: vrai
  • cluster.nom: mon-nœud d'application.nom: node-1 # nœud.rack: r1 # chemin d'accès.journaux: /chemin/vers/logs # bootstrap.memory_lock: véritable réseau.hôte: 0.0.0.0 #réseau.bind_host: 0 # http.port: 9200 # découverte.zen.ping.unicast.hôtes: ["host1", "host2"] # découverte.zen.minimum_master_nodes: 3 # la passerelle.recover_after_nodes: 3 n ° de nœud.max_local_storage_nodes: 1 n ° de l'action.destructive_requires_name: vrai
  • elasticsearch.yml a été ajouté Veuillez examiner cette question et de proposer ce que des changements sont nécessaires, en elle.

InformationsquelleAutor Tomas | 2017-03-02