简体   繁体   English

Red Hat 7.2 EAP 中的 JMS 主/备份故障转移和故障回复配置

[英]JMS master/backup failover and failback configuration in Red Hat 7.2 EAP

We use Red Hat 7.2 EAP.我们使用红帽 7.2 EAP。 We have X number of producers on Y number of machines sending messages to a JMS queue on a remote machine.我们有 Y 台机器上的 X 台生产者向远程机器上的 JMS 队列发送消息。 The JMS queue is configured with a master and backup. JMS 队列配置有主和备份。 X number of consumers on Y number of machines are consuming messages from the queue. Y 台机器上的 X 个消费者正在消费队列中的消息。 The master and backup are on different machines. master和backup在不同的机器上。 When the master goes down the producers and consumers need to continue processing messages.当主服务器宕机时,生产者和消费者需要继续处理消息。 When the master comes back the consumers and producers need to fail back to the master.当主服务器回来时,消费者和生产者需要故障回复到主服务器。

I have read the documents published by Red Hat multiple times and best I can tell this should be easily done.我已多次阅读 Red Hat 发布的文档,并且我认为这应该很容易完成。 However, when the consumers or producers start up and the master is down they do not have any way to connect to the backup queue.但是,当消费者或生产者启动并且主服务器关闭时,他们没有任何方式连接到备份队列。 How do people handle this situation?人们如何处理这种情况? Do the consumers and the producers have to be programed to know about the master and the backup and then try to connect to the backup if the master is not available or fails?是否必须对消费者和生产者进行编程以了解主节点和备份节点,然后在主节点不可用或失败时尝试连接到备份节点? The documentation leads me to believe that failover should be automatic in that the master communicates the backup location to client when it first attaches.该文档使我相信故障转移应该是自动的,因为主服务器在第一次连接时会将备份位置传达给客户端。 If there are dozens of machines involved how does the configuration of the master/backup get to the consumers and producers?如果涉及数十台机器,主备备份的配置如何到达消费者和生产者? Do each of the consumer/producer nodes have to be configured with IP addresses?每个消费者/生产者节点都必须配置 IP 地址吗? How do people make this type of thing scale?人们如何使这种类型的东西规模化?

We currently set up the producers and consumers to connect like this:我们目前将生产者和消费者设置为这样连接:

final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, PROVIDER_URL));
env.put(Context.SECURITY_PRINCIPAL, DEFAULT_USERNAME);
env.put(Context.SECURITY_CREDENTIALS, DEFAULT_PASSWORD);
namingContext = new InitialContext(env);

EAP uses a client/server JNDI implementation and JNDI connections are 100% independent of JMS connections. EAP 使用客户端/服务器 JNDI 实现,并且 JNDI 连接 100% 独立于 JMS 连接。 Since JNDI is the starting point for your connectivity with EAP you'll want to tackle that first.由于 JNDI 是您与 EAP 连接的起点,因此您需要首先解决这个问题。 Typically an EAP JNDI URL looks something like this:通常,EAP JNDI URL 看起来像这样:

http-remoting://host:8080

Of course, if host is unavailable then the JNDI lookup will fail.当然,如果host不可用,则 JNDI 查找将失败。 You can address this in a number of ways the most basic of which is specifying multiple URLs, eg:您可以通过多种方式解决此问题,其中最基本的是指定多个 URL,例如:

http-remoting://host1:8080,http-remoting://host2:8080

Other solutions involve dedicated load-balancers, DNS-based redirection, etc.其他解决方案涉及专用负载平衡器、基于 DNS 的重定向等。

Once the JNDI lookup is complete you'll be able to establish a JMS connection.一旦 JNDI 查找完成,您将能够建立 JMS 连接。 Assuming the server pair is set up correctly the connection will then fail-over and fail-back as needed.假设服务器对设置正确,则连接将根据需要进行故障转移和故障回复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM