I have two projects using different versions of Elasticsearch, the first uses 0.9.x and the second will use 1.2.x. What would the best way to install both versions so I can work on the two projects?
2 Answers
[Edit 2019-12-11]: Docker is obviously the way to go now!
Answering to myself, I ended with simple installation scripts like that:
#!/bin/bash
sudo apt-get remove elasticsearch
sudo dpkg -i elasticsearch-0.90.5.deb
sudo rm -rf /usr/share/elasticsearch/plugins
sudo cp -R plugins /usr/share/elasticsearch
sudo cp elasticsearch.yml.0.90.5 /etc/elasticsearch/elasticsearch.yml
sudo /etc/init.d/elasticsearch restart
sleep 2;
sudo /etc/init.d/elasticsearch status
Note that in the elasticsearch.yml file, the cluster name must be different to avoid conflicts:
0.9.5:
cluster.name: cluster_v0
1.7.6:
cluster.name: cluster_v1
And so on.
-
So you uninstalled other version. How do you manage to install both of them? Sep 12, 2016 at 5:53
-
1I don't use both, I install the version I need to use and then I reindex. It's very fast, it can be done in less than one minute with the "dev" data. (of course it's not so fast with a production database)– COilSep 12, 2016 at 8:30
//Get the first ElasticSearch version
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.10.tar.gz
tar -zxf elasticsearch-5.6.10.tar.gz
//Get the second ElasticSearch version you would like to install
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.2.tar.gz
tar -zxf elasticsearch-6.8.2.tar.gz
//Configure the elasticsearch.yml file as follows
vim elasticsearch-5.6.10/config/elasticsearch.yml
cluster.name: elastic_cluster1
node.name: node-1
node.master: true
node.data: true
transport.host: localhost
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0
//Configure elasticsearch.yml file for another ES version
vim elasticsearch-6.8.2/config/elasticsearch.yml
cluster.name: elastic_cluster2
node.name: node-2
#node.master: true
node.data: true
transport.host: localhost
transport.tcp.port: 9304
http.port: 9204
network.host: 0.0.0.0
//To start ElasticSearch Services from Terminal
cd elasticsearch-5.6.10
bin/elasticsearch -d
cd elasticsearch-6.8.2
bin/elasticsearch -d
//Verify the status and confirm the service is installed or not
ps -ef | grep elastic