提问:布和纸怕什么?

elasticsearch id

Elasticsearch | 作者 CatCoder | 发布于2018年12月14日 | 阅读数:4157

elasticsearch使用自动生成的id好还是由时间戳构成id好
Resilience and Efficiency
Faster Restarts and Recoveries with Sequence IDs
One of the biggest features in the 6.0 release is sequence IDs,
which allows for operations-based shard recovery. Previously,
if a node disconnected from the cluster because of a network problem or a node
restart, each shard on the node would have to be resynced by comparing segment
files with the primary shard and copying over any segments that were different.
This could be a long and costly process, that made even rolling restarts of
nodes very slow. With sequence IDs, each shard will be able to replay just the
operations missing from that shard making the recovery process much more efficient.

使用序列ID更快地重新启动和恢复
6.0版本中最大的功能之一是序列ID,它允许基于操作的分片恢复。
以前,如果节点由于网络问题或节点重新启动而与群集断开连接,
则必须通过将段文件与主分片进行比较并复制任何不同的段来重新同步节点上的每个分片。
这可能是一个漫长而昂贵的过程,甚至使节点的滚动重启非常缓慢。使用序列ID,
每个分片将只能重放该分片中缺少的操作,从而使恢复过程更加高效。
6.0版本推荐的序列id,是自动生成的么?
已邀请:

rochy - rochy_he

赞同来自:

如果你的文档具有唯一型,例如:商品 ID 等主键
推荐使用主键作为 ID,这样在进行更新或者删除时都非常方便;
 
如果你对 ID 没有要求,推荐你使用系统自动创建的 ID;
不推荐使用时间戳,因为时间戳可能存在重复现象

要回复问题请先登录注册