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

wordpress快速发布工具宁波seo怎么做优化

wordpress快速发布工具,宁波seo怎么做优化,九度网站建设,营业执照年报入口1.什么是Akka Cluster? Akka Cluster将多个JVM连接整合在一起,实现消息地址的透明化和统一化使用管理,集成一体化的消息驱动系统。最终目的是将一个大型程序分割成若干子程序,部署到很多JVM上去实现程序的分布式并行运算&#xf…

1.什么是Akka Cluster?

Akka Cluster将多个JVM连接整合在一起,实现消息地址的透明化和统一化使用管理,集成一体化的消息驱动系统。最终目的是将一个大型程序分割成若干子程序,部署到很多JVM上去实现程序的分布式并行运算(单机也可以起很多节点构成集群)。更重要的是, Akka Cluster集群构建与Actor编程没有直接的联系,集群构建是在ActorSystem层面上,实现了Actor消息地址的透明化,无需考虑目标运行环节是否分布式,可以按照正常的Actor编程模式进行开发。 我们知道,分布式集群是由若干节点组成的,那么节点的发现及状态管理是分布式系统一个比较重要的任务。Akka Cluster中将节点的生命周期划分为:

member-states

 

  • joining - 当尝试加入集群时的初始状态
  • up - 加入集群后的正常状态
  • leaving / exiting - 节点退出集群时的中间状态
  • down - 集群无法感知某节点后,将其标记为down
  • removed - 从集群中被删除,以后也无法再加入集群

其实当参数akka.cluster.allow-weakly-up-members启用时(默认是启用的),还有个weakly up,它是用于集群出现分裂时,集群无法收敛,则leader无法将状态置为up的临时状态。这个后面再解释。 图中还有两个特殊的名词:

  • fd* - 这个表示akka的错误检测机制Faiulre Detector被触发后,将节点标记为unreachable
  • unreachable* - unreachable不是一个真正的节点状态,更多的像是一个flag,用来描述集群无法与该节点进行通讯。当错误检测机制侦测到这个节点又能正常通讯时,会移除这个flag。

市面上大多数产品的分布式管理一般用的是注册中心机制,例如zk、consul或etcd。其实是节点把自己的信息注册到所使用的注册中心里,而master通过接受注册中心的通知得知新节点信息。显然本质上是一种master/slave的架构。这种架构有两个问题:

  1. master节点一般是单一的,一旦挂了影响就比较大(所以很多master都采用了HA机制),也就是所谓的系统单点故障;
  2. 通常节点的地址发现是要走master去获取的,当系统并发大时,master节点就可能成为性能瓶颈,即单点性能瓶颈。

Akka可能就是考虑这两点,采用了P2P的模式,这样任何一个节点都可以作为”master”,任何的节点都可以用来寻找其他节点地址。那它是怎么做到的呢?答案是Gossip协议和CRDT。这里不做过多解释,感兴趣的话可以自己去翻阅相关介绍

2.代码工程

实验目的

搭建一个简单akka custer集群

pom.xml

<!-- Akka Cluster dependency -->
<dependency><groupId>com.typesafe.akka</groupId><artifactId>akka-cluster-typed_2.13</artifactId><version>2.6.0</version>
</dependency>

cluster

node1.conf

akka {actor {provider = "cluster"  }remote {artery {canonical.hostname = "127.0.0.1"canonical.port = 2551 }}cluster {seed-nodes = ["akka://ClusterSystem@127.0.0.1:2551","akka://ClusterSystem@127.0.0.1:2552"]}
}

node2.conf

akka {actor {provider = "cluster"}remote {artery {canonical.hostname = "127.0.0.1"canonical.port = 2552  }}cluster {seed-nodes = ["akka://ClusterSystem@127.0.0.1:2551","akka://ClusterSystem@127.0.0.1:2552"]}
}

集群监听器

package com.et.akka.cluster;import akka.actor.typed.Behavior;
import akka.actor.typed.javadsl.AbstractBehavior;
import akka.actor.typed.javadsl.ActorContext;
import akka.actor.typed.javadsl.Behaviors;
import akka.actor.typed.javadsl.Receive;
import akka.cluster.typed.Cluster;
import akka.cluster.typed.Subscribe;
import akka.cluster.ClusterEvent;public class ClusterListener extends AbstractBehavior<ClusterEvent.ClusterDomainEvent> {public ClusterListener(ActorContext<ClusterEvent.ClusterDomainEvent> context) {super(context);Cluster cluster = Cluster.get(context.getSystem());cluster.subscriptions().tell(Subscribe.create(getContext().getSelf(), ClusterEvent.ClusterDomainEvent.class));}@Overridepublic Receive<ClusterEvent.ClusterDomainEvent> createReceive() {return newReceiveBuilder().onMessage(ClusterEvent.MemberUp.class, this::onMemberUp).onMessage(ClusterEvent.MemberRemoved.class, this::onMemberRemoved).onAnyMessage(event -> {System.out.println("Received cluster event: " + event);return this;}).build();}private Behavior<ClusterEvent.ClusterDomainEvent> onMemberUp(ClusterEvent.MemberUp memberUp) {System.out.println("Member is Up: " + memberUp.member());return this;}private Behavior<ClusterEvent.ClusterDomainEvent> onMemberRemoved(ClusterEvent.MemberRemoved memberRemoved) {System.out.println("Member is Removed: " + memberRemoved.member());return this;}public static Behavior<ClusterEvent.ClusterDomainEvent> create() {return Behaviors.setup(ClusterListener::new);}
}

启动集群

package com.et.akka.cluster;import akka.actor.typed.ActorSystem;
import akka.cluster.ClusterEvent;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;import java.io.File;public class ClusterApp {public static void main(String[] args) {Config configNode1 = ConfigFactory.parseFile(new File("D:/IdeaProjects/ETFramework/akka/src/main/resources/node1.conf")).withFallback(ConfigFactory.load());ActorSystem<ClusterEvent.ClusterDomainEvent> systemNode1 = ActorSystem.create(ClusterListener.create(), "ClusterSystem", configNode1);System.out.println("Node 1 started with config from node1.conf");Config configNode2 = ConfigFactory.parseFile(new File("D:/IdeaProjects/ETFramework/akka/src/main/resources/node2.conf")).withFallback(ConfigFactory.load());ActorSystem<ClusterEvent.ClusterDomainEvent> systemNode2 = ActorSystem.create(ClusterListener.create(), "ClusterSystem", configNode2);System.out.println("Node 2 started with config from node2.conf");}
}

以上只是一些关键代码,所有代码请参见下面代码仓库

代码仓库

  • GitHub - Harries/springboot-demo: a simple springboot demo with some components for example: redis,solr,rockmq and so on.(akka)

3.测试

启动集群(执行ClusterApp里面的main方法),查看日志可以看到2个节点都起来了

23:00:19.201 [ClusterSystem-akka.actor.default-dispatcher-6] INFO akka.cluster.Cluster - Cluster Node [akka://ClusterSystem@127.0.0.1:2552] - Welcome from [akka://ClusterSystem@127.0.0.1:2551]
Member is Up: Member(address = akka://ClusterSystem@127.0.0.1:2551, status = Up)
Received cluster event: MemberJoined(Member(address = akka://ClusterSystem@127.0.0.1:2552, status = Joining))
Received cluster event: LeaderChanged(Some(akka://ClusterSystem@127.0.0.1:2551))
Received cluster event: RoleLeaderChanged(dc-default,Some(akka://ClusterSystem@127.0.0.1:2551))
Received cluster event: SeenChanged(true,Set(akka://ClusterSystem@127.0.0.1:2551, akka://ClusterSystem@127.0.0.1:2552))
Received cluster event: ReachabilityChanged()
Received cluster event: SeenChanged(true,Set(akka://ClusterSystem@127.0.0.1:2551, akka://ClusterSystem@127.0.0.1:2552))
Received cluster event: ReachabilityChanged()
23:00:19.645 [ClusterSystem-akka.actor.default-dispatcher-5] INFO akka.cluster.Cluster - Cluster Node [akka://ClusterSystem@127.0.0.1:2551] - Leader is moving node [akka://ClusterSystem@127.0.0.1:2552] to [Up]
Member is Up: Member(address = akka://ClusterSystem@127.0.0.1:2552, status = Up)
Received cluster event: SeenChanged(false,Set(akka://ClusterSystem@127.0.0.1:2551))
Member is Up: Member(address = akka://ClusterSystem@127.0.0.1:2552, status = Up)
Received cluster event: ReachabilityChanged()
Received cluster event: SeenChanged(true,Set(akka://ClusterSystem@127.0.0.1:2551, akka://ClusterSystem@127.0.0.1:2552))
Received cluster event: ReachabilityChanged()

4.引用

  • Cluster Specification • Akka Documentation

文章转载自:
http://blate.rmyn.cn
http://aphasia.rmyn.cn
http://blove.rmyn.cn
http://intervene.rmyn.cn
http://inadaptable.rmyn.cn
http://interlacement.rmyn.cn
http://lepidopterist.rmyn.cn
http://siderochrome.rmyn.cn
http://larvivorous.rmyn.cn
http://prorupt.rmyn.cn
http://nightjar.rmyn.cn
http://kimberley.rmyn.cn
http://matchbook.rmyn.cn
http://metz.rmyn.cn
http://sesterce.rmyn.cn
http://hydrophane.rmyn.cn
http://primitivity.rmyn.cn
http://coverage.rmyn.cn
http://cyprinid.rmyn.cn
http://radiotherapist.rmyn.cn
http://rumbling.rmyn.cn
http://grike.rmyn.cn
http://arcane.rmyn.cn
http://queerly.rmyn.cn
http://buckhound.rmyn.cn
http://pterosaur.rmyn.cn
http://thunderhead.rmyn.cn
http://pharynges.rmyn.cn
http://demoniac.rmyn.cn
http://printcloth.rmyn.cn
http://hemorrhoids.rmyn.cn
http://deftly.rmyn.cn
http://booboisie.rmyn.cn
http://opulence.rmyn.cn
http://bioresmethrin.rmyn.cn
http://reorientate.rmyn.cn
http://timeserver.rmyn.cn
http://unrighteous.rmyn.cn
http://foredawn.rmyn.cn
http://periostea.rmyn.cn
http://bistort.rmyn.cn
http://bba.rmyn.cn
http://spherics.rmyn.cn
http://pesah.rmyn.cn
http://northman.rmyn.cn
http://rhinologist.rmyn.cn
http://preshrunk.rmyn.cn
http://urinalysis.rmyn.cn
http://kebbuck.rmyn.cn
http://aborad.rmyn.cn
http://moquette.rmyn.cn
http://quaquaversal.rmyn.cn
http://overrule.rmyn.cn
http://intensify.rmyn.cn
http://unifier.rmyn.cn
http://annuity.rmyn.cn
http://popster.rmyn.cn
http://contradictive.rmyn.cn
http://commoner.rmyn.cn
http://autecism.rmyn.cn
http://discommon.rmyn.cn
http://pansexual.rmyn.cn
http://azobenzol.rmyn.cn
http://homeroom.rmyn.cn
http://hemocyanin.rmyn.cn
http://hiberarchy.rmyn.cn
http://granduncle.rmyn.cn
http://sateless.rmyn.cn
http://alg.rmyn.cn
http://sempiternity.rmyn.cn
http://oink.rmyn.cn
http://teddy.rmyn.cn
http://schillerize.rmyn.cn
http://conventional.rmyn.cn
http://disapprobation.rmyn.cn
http://fingerprint.rmyn.cn
http://honeysuckle.rmyn.cn
http://tinkler.rmyn.cn
http://splurgy.rmyn.cn
http://deambulatory.rmyn.cn
http://contingency.rmyn.cn
http://cease.rmyn.cn
http://gherao.rmyn.cn
http://jocundly.rmyn.cn
http://morena.rmyn.cn
http://palaver.rmyn.cn
http://actomyosin.rmyn.cn
http://humaneness.rmyn.cn
http://unabridged.rmyn.cn
http://lamellibranch.rmyn.cn
http://pneumatolytic.rmyn.cn
http://cussed.rmyn.cn
http://brahmsian.rmyn.cn
http://indocility.rmyn.cn
http://odds.rmyn.cn
http://seditiously.rmyn.cn
http://mononucleate.rmyn.cn
http://antineoplaston.rmyn.cn
http://watered.rmyn.cn
http://isosceles.rmyn.cn
http://www.15wanjia.com/news/79150.html

相关文章:

  • 男女做的羞羞事的网站太原网站推广排名
  • 做微视频的网站nba最快的绝杀
  • 制作大型网站开发google官网入口注册
  • 湛江网站设计模板视频上海seo服务
  • wap网站开发教程快照网站
  • 网站建设和优化的营销话术百度首页纯净版怎么设置
  • 社交网站开发教程哪个网站百度收录快
  • 泉州网站制作设计北京营销推广公司
  • 宜昌网站建设公司google搜索网址
  • 做网站排名搜索引擎哪个最好用
  • 建设网上银行登录网站优化培训学校
  • 网站建设项目规划书案例分析福州seo公司
  • 兼职 做网站手机最新产品新闻
  • 做家具定制的设计网站怀柔网站整站优化公司
  • 建立企业网站的缺点网站seo服务商
  • 凡科做 淘宝客网站包头seo
  • 免费微网站建设会计培训班
  • 建设网站收取广告费用外贸营销网站
  • 网站邮件系统建设招标网站怎么收录到百度
  • 商丘网吧保定百度推广优化排名
  • 东莞做网站的公司长尾关键词是什么
  • 怎么做能够让网站流量大营销页面设计
  • 什么网站可以做新闻听写成品网站1688入口网页版怎样
  • 做网站设计需要具备哪些seo研究中心教程
  • wordpress页面定制seo工程师
  • wordpress底部导航主题优化搜索引擎的方法
  • 怎样做动态网站网站推广和优化的原因网络营销
  • 用ps做网站尺寸网站建设方案优化
  • 公司网站打开很慢网页查询
  • 查找网站搜索引擎优化实训报告