...
Bloc de code |
---|
(django_pod3) pod@pod:~/django_projects/podv3$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg OK (django_pod3) pod@pod:~/django_projects/podv3$ sudo apt-get install apt-transport-https (django_pod3) pod@pod:~/django_projects/podv3$ echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list (django_pod3) pod@pod:~/django_projects/podv3$ sudo apt-get update && sudo apt-get install elasticsearch |
Ensuite il faut paramétrer l’instance Voici pour ES8 :
Bloc de code |
---|
(django_pod3) pod@pod:~/django_projects/podv3$ sudo vim /etc/elasticsearch/elasticsearch.yml |
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"] |
Lancement et vérification d'Elasticsearch
Il faut enfin le lancer et vérifier son bon fonctionnement :
...
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg OK (django_pod3) pod@pod:~/django_projects/ |
...
podv3$ sudo apt-get install apt-transport-https (django_pod3) |
...
pod@pod:~/django_projects/ |
...
podv3$ echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
(django_pod3) pod@pod:~/django_projects/podv3$ sudo apt-get update && sudo apt-get install elasticsearch |
Ensuite il faut paramétrer l’instance :
Bloc de code |
---|
(django_pod3) pod@pod:~/django_projects/podv3$ sudo vim /etc/elasticsearch/elasticsearch.yml |
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"] |
Lancement et vérification d'Elasticsearch
Il faut enfin le lancer et vérifier son bon fonctionnement :
(django_pod3) pod@pod:~/django_projects/podv3$ sudo /etc/init.d/elasticsearch start
(django_pod3) pod@pod:~/django_projects/podv3$ curl -XGET "127.0.0.1:9200"
Bloc de code |
---|
{
"name" : "pod-1",
"cluster_name" : "pod-application",
"cluster_uuid" : "5yhs9zc4SRyjaKYyW7uabQ",
"version" : {
"number" : "8.4 |
...
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_versionbuild_flavor" : "default", "build_type" : "deb", "build_hash" : "7.17.0", "minimum_index_compatibility_version" : "7.0.0" }, "tagline" : "You Know, for Search" }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" } |
Pour utiliser la recherche dans Pod, nous allons avoir besoin également du plugin ICU :
Bloc de code |
---|
(django_pod3) pod@pod:~/django_projects/podv3$ cd /usr/share/elasticsearch/
(django_pod3) pod@pod:/usr/share/elasticsearch$ sudo bin/elasticsearch-plugin install analysis-icu
-> Downloading analysis-icu from elastic
[=================================================] 100%
-> Installed analysis-icu
(django_pod3) pod@pod:/usr/share/elasticsearch$ sudo /etc/init.d/elasticsearch restart
[ ok ] Restarting elasticsearch (via systemctl): elasticsearch.service. |
Si vous utilisez derrière un proxy Pour utiliser la recherche dans Pod, nous allons avoir besoin également du plugin ICU :
Bloc de code |
---|
(django_pod3) pod@pod:~/django_projects/podv3$ cd /usr/share/elasticsearch/ (django_pod3) pod@pod:/usr/share/elasticsearch$ sudo ES_JAVA_OPTS="-Dhttp.proxyHost=proxy.univ.fr -Dhttp.proxyPort=3128 -Dhttps.proxyHost=proxy.univ.fr -Dhttps.proxyPort=3128" /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu -> Downloading analysis-icu from elastic [=================================================] 100% -> Installed analysis-icu (django_pod3) pod@pod:/usr/share/elasticsearch$ sudo /etc/init.d/elasticsearch restart [ ok ] Restarting elasticsearch (via systemctl): elasticsearch.service. |
Si vous utilisez Attention, pour ES8 derrière un proxy :
Bloc de code |
---|
(django_pod3) pod@pod:~/django_projects/podv3$ cd /usr/share/elasticsearch/ (django_pod3) pod@pod:/usr/share/elasticsearch$ sudo ESCLI_JAVA_OPTS="-Dhttp.proxyHost=proxy.univ.fr -Dhttp.proxyPort=3128 -Dhttps.proxyHost=proxy.univ.fr -Dhttps.proxyPort=3128" /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu -> Downloading analysis-icu from elastic [=================================================] 100% -> Installed analysis-icu (django_pod3) pod@pod:/usr/share/elasticsearch$ sudo /etc/init.d/elasticsearch restart [ ok ] Restarting elasticsearch (via systemctl): elasticsearch.service. |
...