Update ElasticSearch

From Archivematica
(Difference between revisions)
Jump to: navigation, search
(ElasticSearch update)
(ElasticSearch update)
Line 68: Line 68:
 
   /usr/share/archivematica/virtualenvs/archivematica-dashboard/bin/python manage.py reindex_from_remote_cluster http://localhost:9500
 
   /usr/share/archivematica/virtualenvs/archivematica-dashboard/bin/python manage.py reindex_from_remote_cluster http://localhost:9500
 
   ";
 
   ";
 +
 +
The command should finish with
 +
 
 +
  All reindex requests ended successfully!
 +
  
 
13. Verify that the new indexes were created and populated:
 
13. Verify that the new indexes were created and populated:

Revision as of 12:10, 19 February 2019

ElasticSearch update

1. Check that ES is up and running, and note the results:

 curl -X GET "localhost:9200/_cat/indices?v"
 health status index     pri rep docs.count docs.deleted store.size pri.store.size 
 yellow open   aips        5   1         11            0    267.9kb        267.9kb 
 yellow open   transfers   5   1         24            0     35.2kb         35.2kb

2. Stop elasticsearch service

 sudo service elasticsearch stop

3. Download a temporary copy of elasticsearch (same version than intalled)

 wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.tar.gz

4. Uncompress the downloaded tar.gz and go into it

 tar zxvf elasticsearch-1.7.5.tar.gz
 cd elasticsearch-1.7.5

5. Copy data from system wide installed elasticsearch, ot the temporary copy

 cp /var/lib/elasticsearch data -rf

6. Adjust file permissions

 chown <your user>:<your group> data -R

7. Launch the temporary elasticsearch instance

 ./bin/elasticsearch -d -p elastic-tmp.pid -Des.http.port=9500

8. Verify that the indexes were properly copied

 curl -X GET "localhost:9500/_cat/indices?v"

9. Remove elasticsearch 1.7.5 and it's files

 Redhat: sudo yum remove elasticsearch
 Ubuntu: sudo apt-get remove elasticsearch
 rm -rf /var/lib/elasticsearch

10. Upgrade archivematica and install elasticsearch 6

 ansible-playbook -i hosts singlenode.yml --tags=elasticsearch,archivematica-src

11. Configure ElasticSearch 6 to handle reindex from the temporary es

 echo 'reindex.remote.whitelist: localhost:9500' | sudo tee -a /etc/elasticsearch/elasticsearch.yml
 sudo service elasticsearch restart

12. Migrate the indexes

 sudo -u archivematica bash -c " \
 set -a -e -x
 source /etc/default/archivematica-dashboard || \
 source /etc/sysconfig/archivematica-dashboard \
       || (echo 'Environment file not found'; exit 1)
 cd /usr/share/archivematica/dashboard
 /usr/share/archivematica/virtualenvs/archivematica-dashboard/bin/python manage.py reindex_from_remote_cluster http://localhost:9500
 ";

The command should finish with

 All reindex requests ended successfully!

13. Verify that the new indexes were created and populated:

 curl -X GET "localhost:9200/_cat/indices?v" 
 health status index         uuid                   pri rep docs.count docs.deleted store.size pri.store.size
 yellow open   aips          IL7lbAZFR9adKg-GpgepTw   5   1          1            0    135.8kb        135.8kb
 yellow open   transferfiles hlG1GBwIRNCi1rI74LhQpQ   5   1         23            0     49.1kb         49.1kb
 yellow open   transfers     ebRiOvutR_e7N4dNGoNq4w   5   1          1            0        6kb            6kb
 yellow open   aipfiles      2QFnLdr7Txi2qgG2C7-eJw   5   1         10            0    158.7kb        158.7kb

You should have 4 indexes now, and the sum of the aips and aipfiles docs.count column should be equal to the doc.count for the aip index in ElasticSearch 1.7.5. The same happens with the transfers/transferfiles indexes.

14. Stop the temporary elasticsearch service

 kill $(cat ~/elasticsearch-1.7.5/elastic-tmp.pid)

15. Restart all archivematica services

 service archivematica-dashboard restart
 service archivematica-mcp-server restart
 service archivematica-mcp-client restart
 service archivematica-storage-service restart
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox