当前位置: 首页 > news >正文

大连开发区网站开发公司网站开发翻译插件

大连开发区网站开发公司,网站开发翻译插件,信用卡申请网站建设,装修公司室内装饰Elasticsearch中#xff0c;在node的配置中可以指定path.data用来作为节点数据的存储目录#xff0c;而且我们可以指定多个值来作为数据存储的路径#xff0c;那么Elasticsearch是如何判断应该存储到哪个路径下呢#xff1f;今天我就记录一下这个问题。 Elasticsearch的索…Elasticsearch中在node的配置中可以指定path.data用来作为节点数据的存储目录而且我们可以指定多个值来作为数据存储的路径那么Elasticsearch是如何判断应该存储到哪个路径下呢今天我就记录一下这个问题。 Elasticsearch的索引创建过程 集群master收到创建索引的请求后经过创建索引的一些步骤最终会将索引创建完成的请求提交到ClusterStatemaster将根据ClusterState分发给所有节点涉及创建shard的节点会读取本地可用的path.data然后依据一定的规则获取路径。创建基本shard路径保存基本的shard信息。 如何确定在哪个目录下 源码 主要调用的是ShardPath的selectNewPathForShard方法 for (NodeEnvironment.NodePath nodePath : env.nodePaths()) {totFreeSpace totFreeSpace.add(BigInteger.valueOf(nodePath.fileStore.getUsableSpace()));}// TODO: this is a hack!! We should instead keep track of incoming (relocated) shards since we know// how large they will be once theyre done copying, instead of a silly guess for such cases:// Very rough heuristic of how much disk space we expect the shard will use over its lifetime, the max of current average// shard size across the cluster and 5% of the total available free space on this node:BigInteger estShardSizeInBytes BigInteger.valueOf(avgShardSizeInBytes).max(totFreeSpace.divide(BigInteger.valueOf(20)));// TODO - do we need something more extensible? Yet, this does the job for now...final NodeEnvironment.NodePath[] paths env.nodePaths();// If no better path is chosen, use the one with the most space by defaultNodeEnvironment.NodePath bestPath getPathWithMostFreeSpace(env);if (paths.length ! 1) {MapNodeEnvironment.NodePath, Long pathToShardCount env.shardCountPerPath(shardId.getIndex());// Compute how much space there is on each pathfinal MapNodeEnvironment.NodePath, BigInteger pathsToSpace new HashMap(paths.length);for (NodeEnvironment.NodePath nodePath : paths) {FileStore fileStore nodePath.fileStore;BigInteger usableBytes BigInteger.valueOf(fileStore.getUsableSpace());pathsToSpace.put(nodePath, usableBytes);}bestPath Arrays.stream(paths)// Filter out paths that have enough space.filter((path) - pathsToSpace.get(path).subtract(estShardSizeInBytes).compareTo(BigInteger.ZERO) 0)// Sort by the number of shards for this index.sorted((p1, p2) - {int cmp Long.compare(pathToShardCount.getOrDefault(p1, 0L),pathToShardCount.getOrDefault(p2, 0L));if (cmp 0) {// if the number of shards is equal, tie-break with the number of total shardscmp Integer.compare(dataPathToShardCount.getOrDefault(p1.path, 0),dataPathToShardCount.getOrDefault(p2.path, 0));if (cmp 0) {// if the number of shards is equal, tie-break with the usable bytescmp pathsToSpace.get(p2).compareTo(pathsToSpace.get(p1));}}return cmp;})// Return the first result.findFirst()// Or the existing best path if there arent any that fit the criteria.orElse(bestPath);}statePath bestPath.resolve(shardId);dataPath statePath;}过程分析 首先判断是否自定义了path.data没有自定义就在默认路径下创建自定义的情况下确保节点下最少有5%的空间可以使用获取所有的paths然后设置默认最佳的path是当前拥有最多空间的path遍历所有的paths首先过滤掉没有空间的path如果最终没有符合的就返回4步骤的path否则继续6步骤按照规则对paths排序首先判断每个path下该索引的shard数优先返回含有本索引的shard数最少的path 当条件结果相同对比每个path中包含有的shard总数所有索引的返回包含shard数最少的path 当2条件结果相同对比可用空间返回可用空间最大的path生成相应的路径创建目录等信息。
http://www.pierceye.com/news/95361/

相关文章:

  • 做网站怎么选择上市公司wordpress 进销存
  • 做视频网站用哪个模板昆明贤邦网站建设
  • 自建网站工具wordpress仿内涵段子
  • 做推广最好的网站是哪个菜鸟网站建设
  • 首钢建设公司网站微信网站怎么做的好处
  • 西安网站开发费用网站即将 模板
  • 个人做商业网站需要什么热门网站建设代理
  • 企业网站手机端和pc端一个后台吗企业网站管理系统的运维服务
  • 北京官网开发优化游戏性能的软件
  • 网站开发选asp还是hph集约化网站群建设情况
  • 做网站域名重要吗10000ip网站怎么做
  • 途牛的旅游网站是谁做的wordpress 注册用户列表
  • 如何编辑网站新吁网站建设
  • 网站开发采集工具免费引流在线推广
  • 全面的锦州网站建设西安建筑工程有限公司
  • 做网站 郑州公司哪家好哪个购物网站最便宜
  • dedecms网站后台免费网页小游戏
  • 如何查网站外链wordpress火车头采集免费版
  • 四川住房建设和城乡建设厅新网站wordpress 采集 api
  • 企业所得税怎么交南昌seo实用技巧
  • 深圳英文网站开发企业网站和展板建设
  • 国内网站设计制作网页游戏传奇盛世开服表
  • 网站图片放大特效怎么做网站建设的后期服务要包括什么软件
  • 网站降权投诉商标注册证书电子版怎么查询
  • 济南网站制作公司哪家好网站建设搞笑广告词
  • 建设主管部门门户网站摄影网站源码 免费下载
  • js 曲线 网站营销型网站方案书
  • 如何盗取网站软件开发的自学教程
  • 傻瓜建站家庭网络搭建网站
  • 扬中做网站的公司静态网页生成器