Upgrade ELK5.6.1 cluster to cluster 6.6.0 update document (full version)
Environment Introduction:
elasticsearch-5.6.1 --- elasticsearch-6.6.0
kibana-5.6.1 --- kibana-6.6.0
Logstash-5.6.1 --- Logstash-6.6.0
IP |
Character |
10.0.9.24 |
Elasticsearch , Kibana |
10.0.9.25 |
Elasticsearch(master) |
10.0.8.50 |
Logstash |
A, Elasticsearch upgrade
1. Backup all indexes
① modify the configuration file, increase the backup repository settings
vim elasticsearch.yml
path.repo: [ "/ elk / data / bak"] on a file folder # must exist, the path must be a network disk, such as NFS
② create a repository name
curl -XPUT http://10.0.9.25:9200/_snapshot/my_fs_backup -H 'Content-Type: application/json' -d'{"type": "fs","settings": {"location": "/elk/data/bak/Backup20190531.bk","compress": true}}'
③ index back up to the warehouse
curl -XPUT http://10.0.9.25:9200/_snapshot/my_fs_backup/snapshot_1?wait_for_completion=true
④ view backup status information
curl -XGET http://10.0.9.25:9200/_snapshot/my_backup/snapshot_1 curl -XGET http://10.0.9.25:9200/_snapshot/my_backup/_all curl -XGET http://10.0.9.25:9200/_snapshot/my_backup/snapshot_1/status
2. Stop debris distribution
curl -XPUT '10.0.9.24:9200/_cluster/settings?pretty' -H 'Content-Type: application/json' -d' { "persistent": { "cluster.routing.allocation.enable": "none" } }'
3. Refresh synchronization status (optional)
curl -XPOST '10.0.9.24:9200/_flush/synced?pretty'
4. Shut down all nodes
①ps -ef|grep elastic
②kill -9 pid
5. Upgrade the software version
①tar xvf elasticsearch-6.6.0.tar.gz
②mv elasticsearch-6.6.0 /elk/
6. Modify the configuration file, redirected the original data directory and logs directories
①cd /elk/elasticsearch-6.6.0
②vim config / elasticsearch.yml
cluster.name: myapp node.name: elk_node1 path.data: /elk/data bootstrap.memory_lock: true bootstrap.system_call_filter: false network.host: 10.0.9.25 http.port: 9200 discovery.zen.ping.unicast.hosts: ["10.0.9.24", "10.0.9.25"] discovery.zen.minimum_master_nodes: 1 # if there are 3 nodes, configured here 2 gateway.recover_after_nodes: 1 gateway.expected_nodes: 2 gateway.recover_after_time: 4m action.auto_create_index: true cluster.routing.allocation.same_shard.host: true thread_pool.bulk.queue_size: 1000 node.data: true path.repo: ["/elk/data/bak"]
7. Upgrade x-pack index
① get x-pack index status
curl -XGET 10.0.9.24:9200/_xpack/migration/assistance
② upgrade all indexes
curl -XPOST 10.0.9.24:9200/_xpack/migration/upgrade/.security curl -XPOST 10.0.9.24:9200/_xpack/migration/upgrade/.watches curl -XPOST 10.0.9.24:9200/_xpack/migration/upgrade/.triggered_watches
8. Start the service, view the health status
① start elasticsearch
./bin/elasticsearch -d
curl -XGET '10.0.9.24:9200/_cat/health?pretty' curl -XGET '10.0.9.24:9200/_cat/nodes?pretty'
9. Recover debris distribution
curl -XPUT '10.0.9.24:9200/_cluster/settings?pretty' -H 'Content-Type: application/json' -d' { "persistent": { "cluster.routing.allocation.enable": "true" } }'
Two, Kibana upgrade
1. unzip and copy
①tar xvf kibana-6.6.0-linux-x86_64.tar.gz
②mv Kibana-6.6.0-linux-x86_64 / elk
2. Modify the configuration file
①cd /elk/kibana-6.6.0-linux-x86_64
②vim config / kibana.yml
server.port: 7601 server.host: "10.0.9.24" elasticsearch.hosts: "http://10.0.9.24:9200" # Elasticsearch.username: "elastic" # here must combine to crack and X-PACK #elasticsearch.password: "changeme" pid.file: /elk/kibana-6.6.0-linux-x86_64/kibana.pid logging.dest: stdout
3. The index rebuild .kibana
① Set .kibana the index space is read-only (block.sh)
curl -XPUT '10.0.9.24:9200/.kibana/_settings?pretty' -H 'Content-Type: application/json' -d' { "index.blocks.write": true }'
② to create a new index space .kibana-6 (new_space.sh)
curl -XPUT '10.0.9.24::9200/.kibana-6?pretty' -H 'Content-Type: application/json' -d' { "settings" : { "number_of_shards" : 1, "index.mapper.dynamic": false }, "mappings" : { "doc": { "properties": { "type": { "type": "keyword" }, "updated_at": { "type": "date" }, "config": { "properties": { "buildNum": { "type": "keyword" } } }, "index-pattern": { "properties": { "fieldFormatMap": { "type": "text" }, "fields": { "type": "text" }, "intervalName": { "type": "keyword" }, "notExpandable": { "type": "boolean" }, "sourceFilters": { "type": "text" }, "timeFieldName": { "type": "keyword" }, "title": { "type": "text" } } }, "visualization": { "properties": { "description": { "type": "text" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { "type": "text" } } }, "savedSearchId": { "type": "keyword" }, "title": { "type": "text" }, "uiStateJSON": { "type": "text" }, "version": { "type": "integer" }, "visState": { "type": "text" } } }, "search": { "properties": { "columns": { "type": "keyword" }, "description": { "type": "text" }, "hits": { "type": "integer" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { "type": "text" } } }, "sort": { "type": "keyword" }, "title": { "type": "text" }, "version": { "type": "integer" } } }, "dashboard": { "properties": { "description": { "type": "text" }, "hits": { "type": "integer" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { "type": "text" } } }, "optionsJSON": { "type": "text" }, "panelsJSON": { "type": "text" }, "refreshInterval": { "properties": { "display": { "type": "keyword" }, "pause": { "type": "boolean" }, "section": { "type": "integer" }, "value": { "type": "integer" } } }, "timeFrom": { "type": "keyword" }, "TimeRestore": { "type": "boolean" }, "timeTo": { "type": "keyword" }, "title": { "type": "text" }, "uiStateJSON": { "type": "text" }, "version": { "type": "integer" } } }, "url": { "properties": { "accessCount": { "type": "long" }, "accessDate": { "type": "date" }, "createDate": { "type": "date" }, "url": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 2048 } } } } }, "server": { "properties": { "uuid": { "type": "keyword" } } }, "timelion-sheet": { "properties": { "description": { "type": "text" }, "hits": { "type": "integer" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { "type": "text" } } }, "timelion_chart_height": { "type": "integer" }, "timelion_columns": { "type": "integer" }, "timelion_interval": { "type": "keyword" }, "timelion_other_interval": { "type": "keyword" }, "timelion_rows": { "type": "integer" }, "timelion_sheet": { "type": "text" }, "title": { "type": "text" }, "version": { "type": "integer" } } }, "graph-workspace": { "properties": { "description": { "type": "text" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { "type": "text" } } }, "numLinks": { "type": "integer" }, "numVertices": { "type": "integer" }, "title": { "type": "text" }, "version": { "type": "integer" }, "wsState": { "type": "text" } } } } } } }'
③ The index to redirect the .kibana .kibana-6 (reindex.sh)
curl -XPOST '10.0.9.24:9200/_reindex?pretty' -H 'Content-Type: application/json' -d' { "source": { "index": ".kibana" }, "dest": { "index": ".kibana-6" }, "script": { "inline": "ctx._source = [ ctx._type : ctx._source ]; ctx._source.type = ctx._type; ctx._id = ctx._type + \":\" + ctx._id; ctx._type = \"doc\"; ", "lang": "painless" } }'
④ will .kibana-6 this index is synonymous .kibana, and delete the old index, namely .kibana (rename.sh)
curl -XPOST '10.0.9.24:9200/_aliases?pretty' -H 'Content-Type: application/json' -d' { "actions" : [ { "add": { "index": ".kibana-6", "alias": ".kibana" } }, { "remove_index": { "index": ".kibana" } } ] }'
4. Data Catalog data migration to the new version of the directory
cp s /elk/kibana-5.6.1-linux-x86_64/data/* /elk/kibana-6.6.0-linux-x86_64/data
5. Install the new plug-alarm sentinl
①mv sentinl-v6.6.0.zip /elk/kibana-6.6.0-linux-x86_64/plugins
②cd /elk/kibana-6.6.0-linux-x86_64/plugins
③unzip sentinl-v6.6.0.zip
④mv kibana / sentinl.
⑤rm -rf kibana
6. Shut down the old process, start a new service
①ps -ef | grep node
②kill -9 pid
③cd /elk/kibana-6.6.0-linux-x86_64/
④. / Bin / kibana &
Three, Logstash upgrade
1. unzip and copy
①tar xvf logstash-6.6.0.tar.gz
②mv logstash-6.6.0 / elk
2. Configuration files are copied
①cd /elk/logstash-6.6.0
②cp /elk/logstash-5.6.1/wls.conf /elk/logstash-6.6.0 # copy profile
③cp /elk/logstash-5.6.1/startlogstash /elk/logstash-6.6.0 # copy startup script
④cp /elk/logstash-5.6.1/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-4.1.2/patterns/wls
/elk/logstash-6.6.0/vendor/bundle/jruby/2.3.0/gems/logstash-patterns-core-4.1.2/patterns/ # copy the custom regular file
3. Modify the configuration file
Wls.conf ①vim # regular checking whether there is extra spaces and carriage returns
②vim startlogstash Modifying the first line # WorkDir = / elk / logstash-6.6.0
③vim conf / logstash.yml
http.host: "10.0.8.50" xpack.monitoring.enabled: true xpack.monitoring.elasticsearch.url: "http://10.0.9.24:9200" xpack.monitoring.elasticsearch.username: "elastic" xpack.monitoring.elasticsearch.password: "changeme"
④vim conf/jvm..options
-Xms3g -Xmx3g
4. Turn off the old process, start a new service
①ps -if | grep logs tash
②kill -9 pid
③cd /elk/logstash-6.6.0
④./startlogstash start