Merge branch 'master' into AddSSLSupport
This commit is contained in:
commit
85d0742acf
1 changed files with 80 additions and 4 deletions
|
|
@ -8,13 +8,89 @@ See [554#issuecomment-496804929](https://github.com/elastic/ansible-elasticsearc
|
||||||
|
|
||||||
If you have single-instances hosts and want to upgrade from previous versions of the role:
|
If you have single-instances hosts and want to upgrade from previous versions of the role:
|
||||||
|
|
||||||
|
### Procedure with data move
|
||||||
|
|
||||||
|
This procedure will allow you to move your data to the new standard paths (see [#581](https://github.com/elastic/ansible-elasticsearch/issues/581)):
|
||||||
|
|
||||||
|
1. Stop Elasticsearch before the migration
|
||||||
|
|
||||||
|
2. Migrate your data to the new standard paths:
|
||||||
|
```
|
||||||
|
# mv /etc/elasticsearch/${ES_INSTANCE_NAME}/* /etc/elasticsearch/ && rm -fr /etc/elasticsearch/${ES_INSTANCE_NAME}/
|
||||||
|
mv: overwrite '/etc/elasticsearch/elasticsearch.keystore'? y
|
||||||
|
# mv /var/lib/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/* /var/lib/elasticsearch/ && rm -fr /var/lib/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/
|
||||||
|
# ls /var/lib/elasticsearch/
|
||||||
|
nodes
|
||||||
|
# mv /var/log/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/* /var/log/elasticsearch/ && rm -fr /var/log/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/
|
||||||
|
# rm -fr /var/run/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Update playbook (remove `es_conf_dir`, `es_data_dirs`, `es_log_dir`, `es_pid_dir` and `es_instance_name` variables)
|
||||||
|
|
||||||
|
4. Update ansible-role to new version ([7.1.1](https://github.com/elastic/ansible-elasticsearch/releases/tag/7.1.1) at the time of writing) and deploy ansible-role
|
||||||
|
|
||||||
|
5. After ansible-role new deployment, you can do some cleanup of old Init file and Default file:
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
$ systemctl stop elasticsearch
|
||||||
|
$ mv /etc/elasticsearch/${ES_INSTANCE_NAME}/* /etc/elasticsearch/ && rm -fr /etc/elasticsearch/${ES_INSTANCE_NAME}/
|
||||||
|
mv: overwrite '/etc/elasticsearch/elasticsearch.keystore'? y
|
||||||
|
$ mv /var/lib/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/* /var/lib/elasticsearch/ && rm -fr /var/lib/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/
|
||||||
|
$ ls /var/lib/elasticsearch/
|
||||||
|
nodes
|
||||||
|
$ mv /var/log/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/* /var/log/elasticsearch/ && rm -fr /var/log/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/
|
||||||
|
$ rm -fr /var/run/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}/
|
||||||
|
$ ansible-galaxy install --force elastic.elasticsearch,7.1.1
|
||||||
|
- changing role elastic.elasticsearch from 6.6.0 to 7.1.1
|
||||||
|
- downloading role 'elasticsearch', owned by elastic
|
||||||
|
- downloading role from https://github.com/elastic/ansible-elasticsearch/archive/7.1.1.tar.gz
|
||||||
|
- extracting elastic.elasticsearch to /home/jmlrt/.ansible/roles/elastic.elasticsearch
|
||||||
|
- elastic.elasticsearch (7.1.1) was installed successfully
|
||||||
|
$ ansible-playbook playbook.yml
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
TASK [elastic.elasticsearch : Create Directories]
|
||||||
|
ok: [localhost] => (item=/var/run/elasticsearch)
|
||||||
|
ok: [localhost] => (item=/var/log/elasticsearch)
|
||||||
|
changed: [localhost] => (item=/etc/elasticsearch)
|
||||||
|
ok: [localhost] => (item=/var/lib/elasticsearch)
|
||||||
|
|
||||||
|
TASK [elastic.elasticsearch : Copy Configuration File]
|
||||||
|
changed: [localhost]
|
||||||
|
|
||||||
|
TASK [elastic.elasticsearch : Copy Default File]
|
||||||
|
changed: [localhost]
|
||||||
|
|
||||||
|
TASK [elastic.elasticsearch : Copy jvm.options File]
|
||||||
|
changed: [localhost]
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
RUNNING HANDLER [elastic.elasticsearch : restart elasticsearch]
|
||||||
|
changed: [localhost]
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
PLAY RECAP
|
||||||
|
localhost : ok=26 changed=6 unreachable=0 failed=0 skipped=116 rescued=0 ignored=0
|
||||||
|
$ find /etc -name '${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}*'
|
||||||
|
/etc/default/node1_elasticsearch
|
||||||
|
/etc/systemd/system/multi-user.target.wants/node1_elasticsearch.service
|
||||||
|
```
|
||||||
|
|
||||||
|
### Procedure without data move
|
||||||
|
|
||||||
|
This procedure will allow you to keep your data to the old paths:
|
||||||
|
|
||||||
1. Override these variables to match previous values:
|
1. Override these variables to match previous values:
|
||||||
```yaml
|
```yaml
|
||||||
es_conf_dir: /etc/elasticsearch/{{ es_instance_name }}
|
es_conf_dir: /etc/elasticsearch/${ES_INSTANCE_NAME}
|
||||||
es_data_dirs:
|
es_data_dirs:
|
||||||
- /var/lib/elasticsearch/{{ inventory_hostname }}-{{ es_instance_name }}
|
- /var/lib/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}
|
||||||
es_log_dir: /var/log/elasticsearch/{{ inventory_hostname }}-{{ es_instance_name }}
|
es_log_dir: /var/log/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}
|
||||||
es_pid_dir: /var/run/elasticsearch/{{ inventory_hostname }}-{{ es_instance_name }}
|
es_pid_dir: /var/run/elasticsearch/${INVENTORY_HOSTNAME}-${ES_INSTANCE_NAME}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Deploy ansible-role. **Even if these variables are overrided, Elasticsearch config file and default option file will change, which imply an Elasticsearch restart.**
|
2. Deploy ansible-role. **Even if these variables are overrided, Elasticsearch config file and default option file will change, which imply an Elasticsearch restart.**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue