Difference between revisions of "Elastic"

From SME Server
Jump to navigationJump to search
Line 2: Line 2:
 
== install and configure==
 
== install and configure==
 
installl elastic repo
 
installl elastic repo
{{:Elastic_repo}}
+
yum install smeserver-extrarepositories-elastic
 
 
 
  signal-event yum-modify
 
  signal-event yum-modify
  
 
install elastic and dependencies (which are not explicits). You now need to choose the version you want ! 6, 5 or 1.6
 
install elastic and dependencies (which are not explicits). You now need to choose the version you want ! 6, 5 or 1.6
  yum install elasticsearch java-1.8.0-openjdk  --enablerepo=elastic1
+
  yum install elasticsearch java-1.8.0-openjdk  --enablerepo=elastic6.x
 +
 
 +
mkdir -p /etc/e-smith/templates-custom/etc/systemd/system-preset/49-koozali.preset/
 +
 
 +
echo '{
 +
 
 +
push @list,qw(elasticsearch);
 +
 
 +
$OUT.="";
 +
 
 +
}
 +
 
 +
'> /etc/e-smith/templates-custom/etc/systemd/system-preset/49-koozali.preset/06elasticsearch
 +
 
 +
expand-template /etc/systemd/system-preset/49-koozali.preset
 +
 
 +
/etc/e-smith/events/actions/systemd-default
  
  

Revision as of 22:02, 27 October 2023

How to set elastic search on SME

install and configure

installl elastic repo

yum install smeserver-extrarepositories-elastic
signal-event yum-modify

install elastic and dependencies (which are not explicits). You now need to choose the version you want ! 6, 5 or 1.6

yum install elasticsearch java-1.8.0-openjdk  --enablerepo=elastic6.x

mkdir -p /etc/e-smith/templates-custom/etc/systemd/system-preset/49-koozali.preset/

echo '{

push @list,qw(elasticsearch);

$OUT.="";

}

'> /etc/e-smith/templates-custom/etc/systemd/system-preset/49-koozali.preset/06elasticsearch

expand-template /etc/systemd/system-preset/49-koozali.preset

/etc/e-smith/events/actions/systemd-default


make it start at every boot

ln -s /etc/rc.d/init.d/e-smith-service  /etc/rc7.d/S95elasticsearch
config set elasticsearch service status enabled 

start it for the first time

service elasticsearch start

migration from 1.x to higher

upgrade to 2.4 and install plugin

yum upgrade elasticsearch --enablerepo=elastic2
service elasticsearch restart
cd /usr/share/elasticsearch
./bin/plugin install https://github.com/elastic/elasticsearch-migration/releases/download/v2.0.4/elasticsearch-migration-2.0.4.zip

run a tunnel from your computer

ssh -L 9200:localhost:9200 user@yourserver

use your favourite browser to fix things and migrate http://localhost:9200/_plugin/elasticsearch-migration then delete plugin and upgrade to 5.x or 6.x

cd /usr/share/elasticsearch
rm plugin/elasticsearch-migration -rf 
yum update elasticsearch --enablerepo=elastic5.x
service elasticsearch restart

reference https://github.com/elastic/elasticsearch-migration/tree/2.x

Snapshots

preparing for snapshots

mkdir /home/e-smith/db/elasticsearch
chown elasticsearch:elasticsearch /home/e-smith/db/elasticsearch/
echo "">> /etc/elasticsearch/elasticsearch.yml
echo 'path.repo: ["/home/e-smith/db/elasticsearch"]' >> /etc/elasticsearch/elasticsearch.yml
service elasticsearch restart
curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -H 'Content-Type: application/json' -d '{
    "type": "fs",
    "settings": {
        "location": "/home/e-smith/db/elasticsearch",
        "compress": true
    }
}PUT /_snapshot/my_backup'

making a snapshot.

curl -XPUT 'http://localhost:9200/_snapshot/my_backup/snapshot1?wait_for_completion=true'

restore all indices, but not the state.

curl -XPUT 'http://localhost:9200/_snapshot/my_backup/snapshot1/_restore'

references and more options : https://www.elastic.co/guide/en/elasticsearch/reference/5.5/modules-snapshots.html

notes

elasticsearch : OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N