# Probleme avec la commande curl

**URL:** https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537
**Category:** Discussions en français
**Created:** [July 9, 2019, 11:47am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537 "2019-07-09T11:47:37Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![busan](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@busan](https://discuss.elastic.co/u/busan)
#### Post date: [July 9, 2019, 11:47am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/1 "2019-07-09T11:47:37Z")

</div>

Salut,  
Quand je rentre la commande:

```
root@elasticsearch:~# curl --noproxy "*" http://127.0.0.1:9200

```

J'obtiens l'erreur suivante:

> curl: (7) Failed to connect to 127.0.0.1 port 9200: Connection refused

Pareil avec :

`root@elasticsearch:~# curl --noproxy "*" http://localhost:9200`

et

`root@elasticsearch:~# curl --noproxy "*" http://10.50.40.184:9200`

Mon elasticsearch.yml:

```
> # ======================== 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 consult the documentation for further information on configuration options:
> # https://www.elastic.co/guide/en/elasticsearch/reference/index.html
> #
> # ---------------------------------- Cluster -----------------------------------
> #
> # Use a descriptive name for your cluster:
> #
> cluster.name: mon_cluster
> #
> # ------------------------------------ Node ------------------------------------
> #
> # Use a descriptive name for the node:
> #
> node.name: mon_node-1
> #
> # Add custom attributes to the node:
> #
> #node.attr.rack: r1
> #
> # ----------------------------------- Paths ------------------------------------
> #
> # Path to directory where to store the data (separate multiple locations by comma):
> #
> path.data: /var/lib/elasticsearch
> #
> # Path to log files:
> #
> path.logs: /var/log/elasticsearch
> #
> # ----------------------------------- Memory -----------------------------------
> #
> # Lock the memory on startup:
> #
> #bootstrap.memory_lock: true
> #
> # Make sure that the heap size 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
> #
> # Set a custom port for HTTP:
> #
> http.port: 9200
> #
> # For more information, consult the network module documentation.
> #
> # --------------------------------- Discovery ----------------------------------
> #
> # Pass an initial list of hosts to perform discovery when this node is started:
> # The default list of hosts is ["127.0.0.1", "[::1]"]
> #
> #discovery.seed_hosts: ["host1", "host2"]
> #
> # Bootstrap the cluster using an initial set of master-eligible nodes:
> #
> #cluster.initial_master_nodes: ["node-1", "node-2"]
> #
> # For more information, consult the discovery and cluster formation module documentation.
> #
> # ---------------------------------- Gateway -----------------------------------
> #
> # Block initial recovery after a full cluster restart until N nodes are started:
> #
> #gateway.recover_after_nodes: 3
> #
> # For more information, consult the gateway module documentation.
> #
> # ---------------------------------- Various -----------------------------------
> #
> # Require explicit names when deleting indices:
> #
> #action.destructive_requires_name: true
> 
> 
> network:
> host: 0.0.0.0
> http:
> port: 9200

```

la commande

```
netstat -natp

```

renvoie:

> Active Internet connections (servers and established)  
> Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name  
> tcp 0 0 127.0.0.53:53 0.0.0.0:\* LISTEN 673/systemd-resolve  
> tcp 0 0 0.0.0.0:22 0.0.0.0:\* LISTEN 1287/sshd  
> tcp 0 0 10.50.40.184:5601 0.0.0.0:\* LISTEN 1748/node  
> tcp 0 64 10.50.40.184:22 10.50.40.194:53837 ESTABLISHED 1539/sshd: elastics  
> tcp6 0 0 :::22 :::\* LISTEN 1287/sshd

on voit que 10.50.40.184:5601 qui correspond à kibana est écouté et il n'y a pas de 10.50.40.184:9200

à noté que j'ai déjà regardé moult forum sans qu'il y ai une réponse convenable.

Bref, si vous avez une solution.

Busan

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 9, 2019, 8:56pm UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/2 "2019-07-09T20:56:31Z")

</div>

Quels sont les logs d'elasticsearch?

---

<div class="post-metadata">

### Author: ![busan](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@busan](https://discuss.elastic.co/u/busan)
#### Post date: [July 10, 2019, 7:15am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/3 "2019-07-10T07:15:00Z")

</div>

Evidement j'ai tout mis sauf les logs 🙃  
[elasticsearch.log](https://gist.github.com/ecureuilfourbe/d64c8e4205458fabe97919bd15f219df)  
Merci pour le coup de main 👍

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 10, 2019, 8:48am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/4 "2019-07-10T08:48:17Z")

</div>

Le problème n'est pas avec la commande `curl`.

Le problème vient du fait que tu as changé les settings et que du coup tu es en mode "production" ce qui fait que tu dois respecter toutes les vérifications.

En l'occurence ce message te dit ce qui ne va pas:

```auto
[2019-07-09T09:33:56,446][ERROR][o.e.b.Bootstrap] [elasticsearch] node validation exception
[1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

```

Du coup, ton noeud ne démarre pas:

```auto
[2019-07-09T09:33:56,619][INFO][o.e.n.Node] [elasticsearch] stopping ...
[2019-07-09T09:33:56,667][INFO][o.e.n.Node] [elasticsearch] stopped
[2019-07-09T09:33:56,667][INFO][o.e.n.Node] [elasticsearch] closing ...
[2019-07-09T09:33:56,691][INFO][o.e.n.Node] [elasticsearch] closed

```

Du coup, `curl` ne peut pas s'y connecter.

Il faut que tu lises ça: [https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html)

En particulier dans ton cas: [https://www.elastic.co/guide/en/elasticsearch/reference/current/\_discovery\_configuration\_check.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/_discovery_configuration_check.html)

---

<div class="post-metadata">

### Author: ![busan](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@busan](https://discuss.elastic.co/u/busan)
#### Post date: [July 10, 2019, 9:31am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/5 "2019-07-10T09:31:57Z")

</div>

Alors j'ai réinstallé elasticsearch et j'ai fais le minimum recommandé par [elastic.co](http://elastic.co), mais cette fois je n'ai pas touché à elasticsearch.yml (à rien d'autre d’ailleurs) et même erreur que plus haut 😕

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 10, 2019, 9:49am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/6 "2019-07-10T09:49:48Z")

</div>

Peux-tu à nouveau copier les logs STP?

---

<div class="post-metadata">

### Author: ![busan](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@busan](https://discuss.elastic.co/u/busan)
#### Post date: [July 10, 2019, 9:56am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/7 "2019-07-10T09:56:38Z")

</div>

[yep](https://gist.github.com/ecureuilfourbe/fac9515b5da79b8a8da8c21db792cc0e)

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 10, 2019, 10:27am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/8 "2019-07-10T10:27:01Z")

</div>

Donc ton serveur a démarré sur `127.0.0.1:9200`:

```auto
[2019-07-10T08:33:20,878][INFO][o.e.h.AbstractHttpServerTransport] [elasticsearch] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}

```

Tu peux donc y accéder localement (depuis la même machine) avec:

```auto
curl 127.0.0.1:9200/

```

---

<div class="post-metadata">

### Author: ![busan](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@busan](https://discuss.elastic.co/u/busan)
#### Post date: [July 10, 2019, 11:27am UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/9 "2019-07-10T11:27:38Z")

</div>

Oui, ça fonctionne, mais comment je peu changer cette ip pour quelque chose de plus parlant du style "truc.machin", ...  
Et j'aurais aussi d'autres questions qui mériterons un nouveau sujet.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 10, 2019, 12:27pm UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/10 "2019-07-10T12:27:06Z")

</div>

Imaginons que l'IP de ta machine soit: "8.8.8.8", à ce moment là, tu dois configurer `network.host` à cette valeur.  
Regarde: [https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html)

Ensuite si tu as une résolution de nom quelque part qui résout `truc.machin` en `8.8.8.8`, ça devrait fonctionner.

Précisions:

- Ne jamais exposer Elasticsearch sur internet ou avec la sécurité adéquate
- Pour avoir une solution qui tourne rapidement et complète, regarde [cloud.elastic.co](http://cloud.elastic.co).

---

<div class="post-metadata">

### Author: ![busan](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@busan](https://discuss.elastic.co/u/busan)
#### Post date: [July 10, 2019, 2:51pm UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/11 "2019-07-10T14:51:30Z")

</div>

Merci pour toutes les infos, je passe le sujet en résolu 👍

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 7, 2019, 2:51pm UTC](https://discuss.elastic.co/t/probleme-avec-la-commande-curl/189537/12 "2019-08-07T14:51:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
