...
| Bloc de code |
|---|
(django_pod3) pod@pod:~/django_projects/podv3$ sudo vim /etc/elasticsearch/elasticsearch.yml |
Puis Puis préciser ces valeurs :
| Bloc de code |
|---|
cluster.name: pod-application node.name: pod-1 discovery.seed_hosts: ["127.0.0.1"] cluster.initial_master_nodes: ["pod-1"]: ["127.0.0.1"] cluster.initial_master_nodes: ["pod-1"] |
Il est recommandé d'utiliser le mode security d'ES8.
Générer l'utilisateur pod pour ES :
| Bloc de code |
|---|
sudo /usr/share/elasticsearch/bin/elasticsearch-users useradd pod -p podpod -r superuser |
Génération des certificats (CA + cert) :
| Bloc de code |
|---|
sudo /usr/share/elasticsearch/bin/elasticsearch-certutil ca
sudo /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
sudo /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.http.ssl.keystore.secure_password
sudo /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.http.ssl.truststore.secure_password |
Copier le fichier .p12 dans /etc/elasticsearch/
| Bloc de code |
|---|
sudo cp elastic-stack-ca.p12 /etc/elasticsearch/
sudo chown pod:pod /etc/elasticsearch/elastic-stack-ca.p12
sudo chmod +r etc/elasticsearch/elastic-stack-ca.p12 |
Dans /etc/elasticsearch/elasticsearch.yml :
| Bloc de code |
|---|
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.verification_mode: certificate
xpack.security.http.ssl.keystore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.http.ssl.truststore.path: /etc/elasticsearch/elastic-certificates.p12
|
Lancement et vérification d'Elasticsearch
...
(django_pod3) pod@pod:~/django_projects/podv3$ curl -XGET "127.0.0.1:9200"
ou pour ES8 (django_pod3) pod@pod:~/django_projects/podv3$ curl -k -XGET 'https://127.0.0.1:9200' -u pod:podpod
| Bloc de code |
|---|
{
"name" : "pod-1",
"cluster_name" : "pod-application",
"cluster_uuid" : "5yhs9zc4SRyjaKYyW7uabQ",
"version" : {
"number" : "8.4.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "f56126089ca4db89b631901ad7cce0a8e10e2fe5",
"build_date" : "2022-08-19T19:23:42.954591481Z",
"build_snapshot" : false,
"lucene_version" : "9.3.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
} |
...