通过升级助手轻松升级

首先

我正在胡言乱语地写着,这是关于Elastic Stack的新功能系列。
虽然我写了许多东西,但由于未发布的内容比较多,如果在之后的修正中发生了变化会让人感到很伤心呢…

嗯,先不说那个。
这次的题目是关于如何使用Upgrade Assistant来将6.x版本升级到7.x版本。

(2019年3月14日更新)
(2019年3月27日更迭)

Upgrade Assistant是什么意思?

在5.6版本中的实施

升级助手本身最早是在5.6版本中引入的。在那个时候,它会帮助确认和指出配置问题,并检查系统使用的索引(如.kibana),同时进行重建。

6.6版本的实施

时间已经过去6.6,升级助手功能已经被实施,朝着7.0版本迈进。

UpgradeAssistant_6.6.png

这里也会对配置部分和索引的检查进行类似于5.6版本的设置。
正如上面的图片所示,它会指出这是在5.6版本之前创建的索引,但这些都需要手动重新索引。
5.6之前的Elasticsearch有相当多的部署案例。一想到要全部重新索引,心情就会变得沉重。

在6.7版本中的实施

所以,现在可以重新对索引进行操作了,该功能已经实现了。

UpgradeAssistant_6.7.png

与6.6版本不同的是,可以看到左侧有一个名为“重新索引”的按钮。
所以,我们只需要点击这个按钮即可。现在就试一试吧。

试用Upgrade Assistant

请用中文将以下内容改写,只需要一个选项:
模式1

我试试普通的指数。

PUT /my_index3
{
   "mappings": {
     "user": {
       "_all": {
         "enabled": true
       }
     }
   }
}

使用5.6版本创建后,将其导入到6.7版本,并尝试在Upgrade Assistant中运行。

my_index3_1.png

“_all将被删除”。此功能在7.0之后将无法使用,系统会提醒并显示类似这样的选项。您只需勾选并执行,如屏幕所示。

my_index3_2.png

过渡顺利完成(屏幕右下角显示「完成」对吧)。
这个程度看起来没有问题。

第二种模式

我会尝试一些有点不同的东西。

PUT my_index5
{
   "mappings": {
     "my_type": {
       "properties": {
         "yes_or_no": {
           "type": "boolean"
         }
       }
     }
   }
}

有一个布尔字段。然后我们将在5.6版本中创建,并尝试在6.7版本中使用升级助手进行升级。

my_index5_1.png

不只是_all,连_source中的布尔值也会被改变哦!如果检查并进行下去,

my_index5_2.png

一切顺利地完成了过渡。
嗯,看起来没问题。

第三种模式

我会继续尝试下去。

PUT my_index2
{
   "mappings": {
     "my_type": {
       "properties": {
         "title": {
           "type": "text"
         },
         "content": {
           "type": "text"
         },
         "date": {
           "type": "date",
           "include_in_all": false
         }
       }
     }
   }
}

试试看,这次的里面包含了include_in_all。

my_index2_1.png

首先,我接受到所有的内容都将被删除的指示。勾选后可以继续进行…

my_index2_2.png

嗯,当我正在创建新的索引时遇到了错误。

[mapper_parsing_exception] [include_in_all] is not allowed for indices created on or after version 6.0.0 as [_all] is deprecated. As a replacement, you can use an [copy_to] on mapping fields to create your own catch all field.

在6.0.0版本之后,将include_in_all添加到Index是不被允许的。在升级助手中,无法继续进行操作。要解决这个问题,您只能修改原来的my_index2的Mapping并删除include_in_all,或者自己重新索引。

第四种模式

我会继续尝试。

PUT my_index
{
   "mappings": {
     "my_parent": {},
     "my_child": {
       "_parent": {
         "type": "my_parent"
       }
     }
   }
}

这明显就是个糟糕的模式,首先它根本不会帮你重新索引。

UpgradeAssistant_6.7_2 .png

这是写在用绿色圈起来的地方。

This index has more than one mapping type, which is not supported in 7.0. This index must be reindexed into one or more single-type indices. Mapping types in use: [my_child, my_parent]

有这种指数模式的人只能自己解决(在Elastic 2.x上创建了的人可能会有很多这种模式?)。

第五个模式

有点奇怪的情况。

原始的指数如下所示。 (Yuan shi de zhi shu ru xia suo shi)

PUT my_index4
{
   "settings": {
     "number_of_shards": 5
   }
}

这没什么特别的。
如果在6.7之后将其收缩,然后尝试升级它…

my_index4_shrinked_1.png

听起来可以,不过……

my_index4_shrinked_2.png

出现了错误。

[illegal_argument_exception] unknown setting [index.resize.source.name] please check that any required plugins are installed, or check the breaking changes documentation for removed settings :: {"path":"/reindexed-v6-my_index4_shrinked","query":{}

索引.調整.源.名字这种东西我可不知道!

GET my_index4_shrinked/_settings
{
   "my_index4_shrinked" : {
     "settings" : {
       "index" : {
         "routing" : {
           "allocation" : {
             "initial_recovery" : {
               "_id" : "C8onVg6uS5Cy9Zd-bvunwA"
             }
           }
         },
         "allocation" : {
           "max_retries" : "1"
         },
         "number_of_shards" : "1",
         "routing_partition_size" : "1",
         "shrink" : {
           "source" : {
             "name" : "my_index4",
             "uuid" : "H5MKwbBUQtCyWd2Kl6mVZA"
           }
         },
         "provided_name" : "my_index4_shrinked",
         "resize" : {
           "source" : {
             "name" : "my_index4",
             "uuid" : "H5MKwbBUQtCyWd2Kl6mVZA"
           }
         },
         "creation_date" : "1550458731700",
         "number_of_replicas" : "1",
         "uuid" : "pbI5MsGnReCGboODcwJ9aQ",
         "version" : {
           "created" : "5061499",
           "upgraded" : "6070099"
         }
       }
     }
   }
}

有几个设定我看不太熟悉。除了之前提到的 index.resize,还有 index.shrink。
看起来,从6.7版本开始,当进行Shrink操作时会附带这些设置。而且还不能删除。
这样一来,升级助手就无法使用了,只能自己重新建立索引了。

“赠品”

这是一个选项。

使用升级助手运行的结果显示,在.kibana中,type字段的值包含在upgrade-assistant-reindex-operation的项目中。

第二个

与6.0〜6.6不同,7.x系列(7.0分支、7.x分支)和8.0系列(主分支)都提供了Upgrade Assistant,而且希望它能继续提供下去并提供更多功能。

最后

有了这个工具,可能会让迁移变得容易些,但也需要注意其中的一些细节。
在进行迁移时,我们应该仔细研究7.0版本的Breaking Changes,并进行相应的处理!

在中文中,只需要提供一个选项进行复述:

补充说明

2019年3月14日

现在可以出现这样的东西了。

Screenshot_2019-03-14 Kibana.png
This index has [1127] fields, which exceeds the automatic field 
expansion limit of 1024 and does not have [index.query.default_field] 
set, which may cause queries which use automatic field expansion, such 
as query_string, simple_query_string, and multi_match to fail if fields 
are not explicitly specified in the query.

Beats系列的索引总体上字段数量都很多,但如果太多的话,可能会在特定查询中出现失败的可能性。

2019年3月27日

因为6.7.0版本已经发布,所以立刻开始构建6.7.1版本。

Screenshot_2019-03-27 Kibana.png

哎呀?按钮被添加了。
点一下吧。

Screenshot_2019-03-27 Kibana(1).png

看了日志,好像有人对设置进行了更改。


[2019-03-27T11:54:07,147][INFO ][o.e.c.s.IndexScopedSettings] [iNU-sMH] updating [index.query.default_field] from [["*"]] to [["apache2.access.agent","apache2.access.geoip.city_name","apache2.access.geoip.continent_name","apache2.access.geoip.country_iso_code","apache2.access.geoip.region_iso_code","apache2.access.geoip.region_name","apache2.access.http_version","apache2.access.method","apache2.access.referrer","apache2.access.remote_ip","apache2.access.url","apache2.access.user_agent.device","apache2.access.user_agent.name","apache2.access.user_agent.original","apache2.access.user_agent.os","apache2.access.user_agent.os_name","apache2.access.user_agent.patch","apache2.access.user_name","apache2.error.client","apache2.error.level","apache2.error.message","apache2.error.module","auditd.log.a0","auditd.log.acct","auditd.log.geoip.city_name","auditd.log.geoip.continent_name","auditd.log.geoip.country_iso_code","auditd.log.geoip.region_iso_code","auditd.log.geoip.region_name","auditd.log.item","auditd.log.items","auditd.log.new_auid","auditd.log.new_ses","auditd.log.old_auid","auditd.log.old_ses","auditd.log.pid","auditd.log.ppid","auditd.log.record_type","auditd.log.res","beat.hostname","beat.name","beat.timezone","beat.version","destination.geo.city_name","destination.geo.continent_name","destination.geo.country_iso_code","destination.geo.region_iso_code","destination.geo.region_name","destination.ip","docker.container.id","docker.container.image","docker.container.name","elasticsearch.audit.action","elasticsearch.audit.event_type","elasticsearch.audit.layer","elasticsearch.audit.origin_address","elasticsearch.audit.origin_type","elasticsearch.audit.principal","elasticsearch.audit.request","elasticsearch.audit.request_body","elasticsearch.audit.uri","elasticsearch.gc.phase.name","elasticsearch.gc.tags","elasticsearch.index.id","elasticsearch.index.name","elasticsearch.node.name","elasticsearch.server.component","elasticsearch.shard.id","elasticsearch.slowlog.extra_source","elasticsearch.slowlog.id","elasticsearch.slowlog.logger","elasticsearch.slowlog.routing","elasticsearch.slowlog.search_type","elasticsearch.slowlog.source_query","elasticsearch.slowlog.stats","elasticsearch.slowlog.took","elasticsearch.slowlog.took_millis","elasticsearch.slowlog.total_hits","elasticsearch.slowlog.total_shards","elasticsearch.slowlog.type","elasticsearch.slowlog.types","error.message","error.type","event.dataset","event.type","file.path","fileset.module","fileset.name","haproxy.backend_name","haproxy.bind_name","haproxy.client.ip","haproxy.destination.ip","haproxy.error_message","haproxy.frontend_name","haproxy.geoip.city_name","haproxy.geoip.continent_name","haproxy.geoip.country_iso_code","haproxy.geoip.region_iso_code","haproxy.geoip.region_name","haproxy.http.request.captured_cookie","haproxy.http.request.captured_headers","haproxy.http.request.raw_request_line","haproxy.http.response.captured_cookie","haproxy.http.response.captured_headers","haproxy.mode","haproxy.process_name","haproxy.server_name","haproxy.source","haproxy.termination_state","host.architecture","host.id","host.ip","host.mac","host.name","host.os.family","host.os.platform","host.os.version","http.request.method","icinga.debug.facility","icinga.debug.message","icinga.debug.severity","icinga.main.facility","icinga.main.message","icinga.main.severity","icinga.startup.facility","icinga.startup.message","icinga.startup.severity","iis.access.agent","iis.access.cookie","iis.access.geoip.city_name","iis.access.geoip.continent_name","iis.access.geoip.country_iso_code","iis.access.geoip.region_iso_code","iis.access.geoip.region_name","iis.access.hostname","iis.access.http_version","iis.access.method","iis.access.query_string","iis.access.referrer","iis.access.remote_ip","iis.access.server_ip","iis.access.server_name","iis.access.site_name","iis.access.url","iis.access.user_agent.device","iis.access.user_agent.name","iis.access.user_agent.original","iis.access.user_agent.os","iis.access.user_agent.os_name","iis.access.user_agent.patch","iis.access.user_name","iis.error.geoip.city_name","iis.error.geoip.continent_name","iis.error.geoip.country_iso_code","iis.error.geoip.region_iso_code","iis.error.geoip.region_name","iis.error.http_version","iis.error.method","iis.error.queue_name","iis.error.reason_phrase","iis.error.remote_ip","iis.error.server_ip","iis.error.url","input.type","kafka.log.class","kafka.log.component","kafka.log.level","kafka.log.message","kafka.log.timestamp","kafka.log.trace.class","kafka.log.trace.full","kafka.log.trace.message","kibana.log.state","kibana.log.tags","kubernetes.container.image","kubernetes.container.name","kubernetes.namespace","kubernetes.node.name","kubernetes.pod.name","kubernetes.pod.uid","log.file.path","log.flags","log.level","log.source.address","logstash.log.level","logstash.log.message","logstash.log.module","logstash.log.thread","logstash.slowlog.event","logstash.slowlog.level","logstash.slowlog.message","logstash.slowlog.module","logstash.slowlog.plugin_name","logstash.slowlog.plugin_params","logstash.slowlog.plugin_type","logstash.slowlog.thread","message","meta.cloud.availability_zone","meta.cloud.instance_id","meta.cloud.instance_name","meta.cloud.machine_type","meta.cloud.project_id","meta.cloud.provider","meta.cloud.region","mongodb.log.component","mongodb.log.context","mongodb.log.message","mongodb.log.severity","mysql.error.level","mysql.error.message","mysql.error.timestamp","mysql.slowlog.host","mysql.slowlog.ip","mysql.slowlog.query","mysql.slowlog.user","netflow.application_category_name","netflow.application_description","netflow.application_group_name","netflow.application_name","netflow.application_sub_category_name","netflow.bgp_next_hop_ipv4_address","netflow.bgp_next_hop_ipv6_address","netflow.class_name","netflow.collector_ipv4_address","netflow.collector_ipv6_address","netflow.destination_ipv4_address","netflow.destination_ipv4_prefix","netflow.destination_ipv6_address","netflow.destination_ipv6_prefix","netflow.destination_mac_address","netflow.dot1q_customer_destination_mac_address","netflow.dot1q_customer_source_mac_address","netflow.encrypted_technology","netflow.exporter.address","netflow.exporter_ipv4_address","netflow.exporter_ipv6_address","netflow.http_content_type","netflow.http_message_version","netflow.http_reason_phrase","netflow.http_request_host","netflow.http_request_method","netflow.http_request_target","netflow.http_user_agent","netflow.information_element_description","netflow.information_element_name","netflow.interface_description","netflow.interface_name","netflow.ip_next_hop_ipv4_address","netflow.ip_next_hop_ipv6_address","netflow.ipv4_router_sc","netflow.metro_evc_id","netflow.mib_context_name","netflow.mib_module_name","netflow.mib_object_description","netflow.mib_object_name","netflow.mib_object_syntax","netflow.mib_object_valuei_pa_ddress","netflow.mobile_imsi","netflow.mobile_msisdn","netflow.mpls_top_label_ipv4_address","netflow.mpls_top_label_ipv6_address","netflow.nat_pool_name","netflow.observation_domain_name","netflow.original_exporter_ipv4_address","netflow.original_exporter_ipv6_address","netflow.p2p_technology","netflow.post_destination_mac_address","netflow.post_nadt_estination_ipv4_address","netflow.post_nadt_estination_ipv6_address","netflow.post_nast_ource_ipv4_address","netflow.post_nast_ource_ipv6_address","netflow.post_source_mac_address","netflow.pseudo_wire_destination_ipv4_address","netflow.sampler_name","netflow.selector_name","netflow.source_ipv4_address","netflow.source_ipv4_prefix","netflow.source_ipv6_address","netflow.source_ipv6_prefix","netflow.source_mac_address","netflow.sta_ipv4_address","netflow.sta_mac_address","netflow.tunnel_technology","netflow.type","netflow.user_name","netflow.virtual_station_interface_name","netflow.virtual_station_name","netflow.vr_fname","netflow.wlan_ssid","netflow.wtp_mac_address","nginx.access.agent","nginx.access.geoip.city_name","nginx.access.geoip.continent_name","nginx.access.geoip.country_iso_code","nginx.access.geoip.region_iso_code","nginx.access.geoip.region_name","nginx.access.http_version","nginx.access.method","nginx.access.referrer","nginx.access.remote_ip","nginx.access.url","nginx.access.user_agent.device","nginx.access.user_agent.name","nginx.access.user_agent.original","nginx.access.user_agent.os","nginx.access.user_agent.os_name","nginx.access.user_agent.patch","nginx.access.user_name","nginx.error.level","nginx.error.message","osquery.result.action","osquery.result.calendar_time","osquery.result.host_identifier","osquery.result.name","postgresql.log.database","postgresql.log.level","postgresql.log.message","postgresql.log.query","postgresql.log.timestamp","postgresql.log.timezone","postgresql.log.user","process.program","prospector.type","read_timestamp","redis.log.level","redis.log.message","redis.log.role","redis.slowlog.args","redis.slowlog.cmd","redis.slowlog.key","service.name","source","source_ecs.geo.city_name","source_ecs.geo.continent_name","source_ecs.geo.country_iso_code","source_ecs.geo.region_iso_code","source_ecs.geo.region_name","source_ecs.ip","stream","suricata.eve.alert.action","suricata.eve.alert.category","suricata.eve.alert.signature","suricata.eve.app_proto","suricata.eve.app_proto_expected","suricata.eve.app_proto_orig","suricata.eve.app_proto_tc","suricata.eve.app_proto_ts","suricata.eve.dest_ip","suricata.eve.dns.rcode","suricata.eve.dns.rdata","suricata.eve.dns.rrname","suricata.eve.dns.rrtype","suricata.eve.dns.type","suricata.eve.email.status","suricata.eve.event_type","suricata.eve.fileinfo.filename","suricata.eve.fileinfo.md5","suricata.eve.fileinfo.sha1","suricata.eve.fileinfo.sha256","suricata.eve.fileinfo.state","suricata.eve.flow.reason","suricata.eve.flow.state","suricata.eve.flow_id","suricata.eve.http.hostname","suricata.eve.http.http_content_type","suricata.eve.http.http_method","suricata.eve.http.http_refer","suricata.eve.http.http_user_agent","suricata.eve.http.protocol","suricata.eve.http.redirect","suricata.eve.http.url","sur

太长了,而且还截断了哈哈

广告
将在 10 秒后关闭
bannerAds