1.解压新软件包
[esadmin@oracle1 soft]$ pwd
/esdb/soft
tar xvf elasticsearch-7.9.2-linux-x86_64.tar.gz
2.停止数据重分布
curl -XPUT http://192.168.1.7:9201/_cluster/settings -H 'Content-Type:application/json' -d'
{
"transient" : {
"cluster.routing.allocation.enable" : "none"
}
}'
--数据落盘
curl http://192.168.1.7:9201/_flush/synced
{
"_shards": {
"total": 53,
"successful": 53,
"failed": 0
},
"xsq-ä½ å¥½": {
"total": 10,
"successful": 10,
"failed": 0
},
"xsq1": {
"total": 10,
"successful": 10,
"failed": 0
},
"xsq3": {
"total": 10,
"successful": 10,
"failed": 0
},
"myindex1": {
"total": 2,
"successful": 2,
"failed": 0
},
"xs1": {
"total": 2,
"successful": 2,
"failed": 0
},
"xsq-index": {
"total": 10,
"successful": 10,
"failed": 0
},
"mydb1": {
"total": 9,
"successful": 9,
"failed": 0
}
}
3.新的文件拷贝到旧的目录
--(1)关机
[esadmin@oracle1 esapp]$ jps
5142 Elasticsearch
5558 Elasticsearch
6664 Jps
4667 Elasticsearch
[esadmin@oracle1 esapp]$ kill -9 5142 5558 4667
[esadmin@oracle1 esapp]$ mv esapp9201 esapp9201.bak
[esadmin@oracle1 esapp]$ mv esapp9201 esapp9202.bak
[esadmin@oracle1 esapp]$ mv esapp9203 esapp9203.bak
mkdir -p esapp9201 esapp9202 esapp9203
--(2)拷贝安装目录
[esadmin@oracle1 esapp]$ cp -r /esdb/soft/elasticsearch-7.9.2/* esapp9201/
[esadmin@oracle1 esapp]$ cp -r /esdb/soft/elasticsearch-7.9.2/* esapp9202/
[esadmin@oracle1 esapp]$ cp -r /esdb/soft/elasticsearch-7.9.2/* esapp9203/
--(3)拷贝
[esadmin@oracle1 esapp]$ cp esapp9201.bak/config/elasticsearch.yml esapp9201/config/
[esadmin@oracle1 esapp]$ cp esapp9201.bak/config/jvm.options esapp9201/config/
[esadmin@oracle1 esapp]$ cp esapp9201.bak/elasticsearch-env esapp9201/
*/
(4)启动节点
/esdb/esapp/esapp9201/bin/elasticsearch &
/esdb/esapp/esapp9202/bin/elasticsearch &
/esdb/esapp/esapp9203/bin/elasticsearch &
4.集群检查
[esadmin@oracle1 ~]$ curl '192.168.1.7:9201/_cat/shards?v' |grep xsq3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3725 100 3725 0 0 133k 0 --:--:-- --:--:-- --:--:-- 139k
xsq3 1 r STARTED 1 6.6kb 192.168.1.7 esdb-node-3
xsq3 1 p STARTED 1 6.6kb 192.168.1.7 esdb-node-2
xsq3 2 p STARTED 3 7kb 192.168.1.7 esdb-node-2
xsq3 2 r STARTED 3 7kb 192.168.1.7 esdb-node-1
xsq3 3 p STARTED 2 6.8kb 192.168.1.7 esdb-node-3
xsq3 3 r STARTED 2 6.8kb 192.168.1.7 esdb-node-2
xsq3 4 p STARTED 1 6.5kb 192.168.1.7 esdb-node-2
xsq3 4 r STARTED 1 6.5kb 192.168.1.7 esdb-node-1
xsq3 0 p STARTED 4 7.3kb 192.168.1.7 esdb-node-3
xsq3 0 r STARTED 4 7.3kb 192.168.1.7 esdb-node-1
[esadmin@oracle1 ~]$ curl '192.168.1.7:9201/_cat/nodes?v'
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.1.7 50 44 7 0.76 0.83 0.58 dilmt - esdb-node-1
192.168.1.7 42 44 7 0.76 0.83 0.58 dilmt * esdb-node-3
192.168.1.7 61 44 7 0.76 0.83 0.58 dilmt - esdb-node-2
[esadmin@oracle1 ~]$ curl http://192.168.1.7:9201/_cat/health?pretty -H 'Content-Type: application/json'
1719479173 09:06:13 escluster1 green 3 3 53 25 0 0 0 0 - 100.0%
5.集群版本查看
[root@oracle1 esapp9201]# ./bin/elasticsearch --version
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.elasticsearch.bootstrap.Elasticsearch (file:/esdb/esapp/esapp9201/lib/elasticsearch-7.9.2.jar)
WARNING: Please consider reporting this to the maintainers of org.elasticsearch.bootstrap.Elasticsearch
WARNING: System::setSecurityManager will be removed in a future release
Version: 7.9.2, Build: default/tar/d34da0ea4a966c4e49417f2da2f244e3e97b4e6e/2020-09-23T00:45:33.626720Z, JVM: 17.0.11
--这个命令看到的集群版本不对。
--这里查询到的还是旧的版本号。
[root@oracle1 esapp9201]# curl 192.168.1.7:9201
{
"name" : "esdb-node-1",
"cluster_name" : "escluster1",
"cluster_uuid" : "qcTTcAm9Q9a6gZP0CH_gsA",
"version" : {
"number" : "7.9.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "083627f112ba94dffc1232e8b42b73492789ef91",
"build_date" : "2020-09-01T21:22:21.964974Z",
"build_snapshot" : false,
"lucene_version" : "8.6.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
--再次重启
[root@oracle1 config]# jps
5142 Elasticsearch
5558 Elasticsearch
8903 Jps
4667 Elasticsearch
[root@oracle1 config]# kill -9 5142 5558 4667
/esdb/esapp/esapp9201/bin/elasticsearch &
/esdb/esapp/esapp9202/bin/elasticsearch &
/esdb/esapp/esapp9203/bin/elasticsearch &
[2024-06-27T17:19:11,782][INFO ][o.e.e.NodeEnvironment ] [esdb-node-2] heap size [256mb], compressed ordinary object pointers [true]
[2024-06-27T17:19:11,995][INFO ][o.e.n.Node ] [esdb-node-2] node name [esdb-node-2], node ID [8bkDoRrrTdyikEJ6mEOKsA], cluster name [escluster1]
[2024-06-27T17:19:18,620][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [esdb-node-2] [controller/9673] [Main.cc@114] controller (64 bit): Version 7.9.2 (Build 6a60f0cf2dd5a5) Copyright (c) 2020 Elasticsearch BV
[2024-06-27T17:19:19,862][INFO ][o.e.x.s.a.s.FileRolesStore] [esdb-node-2] parsed [0] roles from file [/esdb/esapp/esapp9202/config/roles.yml]
[2024-06-27T17:19:21,441][INFO ][o.e.t.NettyAllocator ] [esdb-node-2] creating NettyAllocator with the following configs: [name=unpooled, factors={es.unsafe.use_unpooled_allocator=false, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=256mb}]
[2024-06-27T17:19:21,541][INFO ][o.e.d.DiscoveryModule ] [esdb-node-2] using discovery type [zen] and seed hosts providers [settings]
[2024-06-27T17:19:22,279][WARN ][o.e.g.DanglingIndicesState] [esdb-node-2] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
[2024-06-27T17:19:23,093][INFO ][o.e.n.
--重启后版本变化了。
[esadmin@oracle1 ~]$ curl 192.168.1.7:9201
{
"name" : "esdb-node-1",
"cluster_name" : "escluster1",
"cluster_uuid" : "qcTTcAm9Q9a6gZP0CH_gsA",
"version" : {
"number" : "7.9.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "d34da0ea4a966c4e49417f2da2f244e3e97b4e6e",
"build_date" : "2020-09-23T00:45:33.626720Z",
"build_snapshot" : false,
"lucene_version" : "8.6.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[esadmin@oracle1 ~]$ curl 192.168.1.7:9203
{
"name" : "esdb-node-3",
"cluster_name" : "escluster1",
"cluster_uuid" : "qcTTcAm9Q9a6gZP0CH_gsA",
"version" : {
"number" : "7.9.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "d34da0ea4a966c4e49417f2da2f244e3e97b4e6e",
"build_date" : "2020-09-23T00:45:33.626720Z",
"build_snapshot" : false,
"lucene_version" : "8.6.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
6.总结
ES升级后再重启一次。否则可能版本信息没有变更。