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

中国网站建设公司排行湘潭做网站 活动磐石网络

中国网站建设公司排行,湘潭做网站 活动磐石网络,wordpress文章数据库表,在线logo设计生成器1.设计 1.1 背景 系统启动后#xff0c;所有任务都在被执行#xff0c;如果这时某个节点宕机#xff0c;那它负责的任务就不能执行了#xff0c;这对有稳定性要求的任务是不能接受的#xff0c;所以系统要实现rebalance的功能。 1.2 设计 下面是Job分配与执行的业务点…1.设计 1.1 背景 系统启动后所有任务都在被执行如果这时某个节点宕机那它负责的任务就不能执行了这对有稳定性要求的任务是不能接受的所以系统要实现rebalance的功能。 1.2 设计 下面是Job分配与执行的业务点重分配就是在 follower下线、controller下线、节点新上线进行重分配。理清楚接下来实现就是水到渠成了 2. 实现 2.1 RebalanceJobType 定义了重平衡job的类型 public enum RebalanceJobType {FOLLOWER_OFFLINE(0), CONTROLLER_OFFLINE(1), NODE_ONLINE(2);private int code;RebalanceJobType(int code) {this.code code;}public boolean isFollowerOffline() {return this.code FOLLOWER_OFFLINE.code;}public boolean isControllerOffline() {return this.code CONTROLLER_OFFLINE.code;}public boolean isNodeOnline() {return this.code NODE_ONLINE.code;}} 2.2 AverageJobAllotStrategy 添加了 rebalanceJob的方法只有Controller才能调用对不同的重平衡情况进行分别处理 private MapLong, ListDttaskJob getDttaskJobMap() {ListDttaskJob allDttaskJob getAllDttaskJob();return average(allDttaskJob); }Override public void rebalanceJob(RebalanceJobContext rebalanceJobContext) {if (rebalanceJobContext.getType().isFollowerOffline()|| rebalanceJobContext.getType().isControllerOffline()) {long offlineServerId rebalanceJobContext.getServerId();log.info({}节点{}下线-重平衡job{},rebalanceJobContext.getType().isFollowerOffline() ? follower : controller,offlineServerId,rebalanceJobContext);ListDttaskJob dttaskJobs getByDttaskId(offlineServerId);ListNodeInfo nodeInfoList ServerInfo.getNodeInfoList();MapLong, ListDttaskJob allotMap new HashMap();int i 0;int nodeCount nodeInfoList.size();while (i dttaskJobs.size()) {DttaskJob dttaskJob dttaskJobs.get(i);NodeInfo nodeInfo nodeInfoList.get(i % nodeCount);i;ListDttaskJob dttaskJobList allotMap.getOrDefault(nodeInfo.getServerId(), new ArrayList());dttaskJobList.add(dttaskJob);allotMap.put(nodeInfo.getServerId(), dttaskJobList);}executeDttaskJob(new ExecuteDttaskJobContext(allotMap, true));} else if (rebalanceJobContext.getType().isNodeOnline()) {log.info(节点上线-重平衡job{}, rebalanceJobContext);long onlineServerId rebalanceJobContext.getServerId();MapLong, ListDttaskJob dttaskJobMap BeanUseHelper.entityHelpService().queryDttaskJob();MapLong, ListDttaskJob allotDttaskJobMap getDttaskJobMap();MapLong, ListDttaskJob stopDttaskJobMapOfOldNodes new HashMap();MapLong, ListDttaskJob startDttaskJobMapOfNewNodes new HashMap();ListDttaskJob startDttaskJobs new ArrayList();dttaskJobMap.forEach((serverId, dttaskJobList) - {int size dttaskJobList.size();int newSize allotDttaskJobMap.get(serverId).size();if (size newSize) {ListDttaskJob dttaskJobs dttaskJobList.subList(0, size - newSize);stopDttaskJobMapOfOldNodes.put(serverId, dttaskJobs);startDttaskJobs.addAll(dttaskJobs);}});startDttaskJobMapOfNewNodes.put(onlineServerId, startDttaskJobs);executeDttaskJob(new ExecuteDttaskJobContext(stopDttaskJobMapOfOldNodes, false));executeDttaskJob(new ExecuteDttaskJobContext(startDttaskJobMapOfNewNodes, true));} } 2.3 ServerClientChannelHandler 对节点下线进行重平衡处理 2.4 NodeOnlineMessageService 3. 测试 启动三个节点节点完成选举每个节点执行2个任务 3号节点下线 1 2 节点各分配了一个任务继续执行 3号节点上线 新上线的3号节点重新得到2个任务1 2节点各停止一个任务 至此节点上下线的任务重平衡完成
http://wiki.neutronadmin.com/news/234725/

相关文章:

  • 电子商务网站推广的主要方式国家企业信用平台官网
  • 网站建设意见反馈表公司网站链接怎么弄
  • 做个网站应该怎么做那个网站可以查询美做空基金
  • 天津企业网站建设个人网站做什么好
  • 网站的底部导航怎么做免费网站模板素材
  • 托管竞价账户哪家好昆明市网络优化案例
  • 网站建设毕业答辩ppt模板下载wordpress 获取有图片的文章
  • 做网站怎样盈利服务器网站维护
  • 因网站建设关闭的公告精品课程网站开发的创新点
  • 移动互联网 商业模式北京百度关键词优化
  • 网站如何启用gzip压缩wordpress页面原文件
  • 如何建设高等数学课程网站企业管理咨询公司简介
  • 郴州市宜章网站建设织梦网站 联系方式修改
  • 手机网站制作哪家好对网站开发流程的了解
  • 上不了国外网站怎么做外贸数字重庆公司
  • 个人博客网站取名济南教育论坛网站建设
  • 山东网站建设哪家公司好最新手机发布会
  • 网站建设前端切图廊坊高端品牌网站建设
  • 沈阳做网站哪家公司好手机电脑网站
  • 免费网站代理访问wordpress内容打不开
  • 社区做图网站有哪些内容幼儿保育专业建设规划
  • 汽车网址永州seo快速排名
  • 网站安全建设方案需求分析福州网站建设
  • 手机网站设计公司可去亿企邦wordpress卡蜜主题
  • 零成本游戏网站开发o2o网站建设基本流程
  • 建设电影网站视频素材怎么修改wordpress模板文件路径
  • 项目经理接到网站开发怎么开展1元2元店5元店进货渠道大全
  • 深圳住房网站app石化建设分会网站
  • 给个网站好人有好报怎么搭建自己的网站服务器
  • 网站外链价格室内设计培训学校哪个好