【质量】容错机制

背景:

项目线上使用的中间件ActiveMQ遇到连续FailoverTransport error,reason:  org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>30000) long。

参考:

https://blog.csdn.net/u011305680/article/details/79730646

https://blog.csdn.net/Sun_P0/article/details/50221919?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-6.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-6.channel_param

https://activemq.apache.org/activemq-inactivitymonitor

http://activemq.apache.org/failover-transport-reference.html

1.failover:失效转移
Fail-Over的含义为“失效转移”,是一种备份操作模式,当主要组件异常时,其功能转移到备份组件。其要点在于有主有备,且主故障时备可启用,并设置为主。如Mysql的双Master模式,当正在使用的Master出现故障时,可以拿备Master做主使用

2.failfast:快速失败
从字面含义看就是“快速失败”,尽可能的发现系统中的错误,使系统能够按照事先设定好的错误的流程执行,对应的方式是“fault-tolerant(错误容忍)”。以JAVA集合(Collection)的快速失败为例,当多个线程对同一个集合的内容进行操作时,就可能会产生fail-fast事件。例如:当某一个线程A通过iterator去遍历某集合的过程中,若该集合的内容被其他线程所改变了;那么线程A访问集合时,就会抛出ConcurrentModificationException异常(发现错误执行设定好的错误的流程),产生fail-fast事件。

3.failback:失效自动恢复
Fail-over之后的自动恢复,在簇网络系统(有两台或多台服务器互联的网络)中,由于要某台服务器进行维修,需要网络资源和服务暂时重定向到备用系统。在此之后将网络资源和服务器恢复为由原始主机提供的过程,称为自动恢复

4.failsafe:失效安全
Fail-Safe的含义为“失效安全”,即使在故障的情况下也不会造成伤害或者尽量减少伤害。维基百科上一个形象的例子是红绿灯的“冲突监测模块”当监测到错误或者冲突的信号时会将十字路口的红绿灯变为闪烁错误模式,而不是全部显示为绿灯。

activemq其他配置参考:

TCP Transport - http://activemq.apache.org/tcp-transport-reference
Failover Transport - http://activemq.apache.org/failover-transport-reference.html
Network Broker - http://activemq.apache.org/networks-of-brokers
Connection Configuration - http://activemq.apache.org/connection-configuration-uri
OpenWire Wire Format - http://activemq.apache.org/configuring-wire-formats.html

原文地址:https://www.cnblogs.com/cathygx/p/13626790.html