资料来源:http://developer.51cto.com/art/201903/593835.htm?mobile
1、集群规划
Nodes 之间做读取分离
Master 的配置:这样 Master 不参与 I、O,从数据的搜索和索引操作中解脱出来,专门负责集群的管理工作
node.master: true
node.data: false
node.ingest: false
Coordinating Nodes,只负责路由用户的请求,包括读、写等操作,对内存、网络和 CPU 要求比较高。?????
Coordinating Only Nodes:可以笼统的理解为是一个负载均衡器,或者反向代理,只负责读,本身不写数据,它的配置是:
node.master: false
node.data: false
node.ingest: false
search.remote.connect: false 是禁用跨集群查询,防止在进行集群之间查询时发生二次路由
2、存储策略
Routing
数据不均衡?假如你的业务在北京、上海的数据远远大于其他二三线城市的数据。
1)一种解决办法是单独为这些数据量大的渠道创建独立的 Index,如:
http://localhost:9200/shanghai,beijing,other/_search?routing=android 这样可以根据需要在不同 Index 之间查询,然而每个 Index 中 Shards 的数据可以做到相对均衡。
2)另一种办法是指定 Index 参数 index.routing_partition_size,来解决最终可能产生群集不均衡的问题,指定这个参数后新的算法如下:
shard_num = (hash(_routing) + hash(_id) % routing_partition_size) % num_primary_shards
index.routing_partition_size 应具有大于 1 且小于 index.number_of_shards 的值。指定参数 index.routing_partition_size 后,索引中的 Mappings 必须指定 _routing 为 "required": true,另外 Mappings 不支持 parent-child 父子关系。
3、索引拆分
logs-000001、logs-000002、logs-000003
4、压缩
5、冷热分区等
资料来源:http://developer.51cto.com/art/201903/593835.htm?mobile