[ 
https://issues.apache.org/jira/browse/ARTEMIS-3640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17482432#comment-17482432
 ] 

Gary Tully edited comment on ARTEMIS-3640 at 1/26/22, 4:43 PM:
---------------------------------------------------------------

I was thinking along the lines of two cluster connections (one that is 
configured to do very little but with the external dns conector-ref) and having 
an external and internal acceptor configured, the external acceptor linking to 
the 'external' connector ref. I don't think this will hang together b/c the 
topology internally is broker wide, and not tied to an acceptor, despite the 
possibility that an acceptor can link to a specific cluster connection. Also, I 
don't think there is a way to separate topology from clustering data on a 
cluster connection at the moment.

However, peeking more and after having a chat with [~andytaylor], the 
connector-ref may still be the answer. 
I wonder if it would be possible to have the cluster connector-ref reference a 
uri with both the internal and external dns names?

The url format with multiple hosts is a little strange, I found an example at: 
https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/test/java/org/apache/activemq/artemis/uri/ConnectionFactoryURITest.java#L233
{code:java}
<connectors>
   <connector 
name="artemis-master">tcp://internal-cluster-dns-1:61616</connector>
   <connector 
name="artemis-slave">tcp://internal-cluster-dns-2:61616</connector>

  <!-- expose external and internal dns to clients - reference this from the 
cluster-connecton.connector-ref may need to verify the exact format! -->
 <connector 
name="artemis-master-internal-and-external">(tcp://internal-cluster-dns-1:61616?,tcp://external-cluster-dns-1:61616?)</connector>
</connectors> 
{code}
and share that as topology information, to both internal and external clients.
{code:java}
<cluster-connections>
   <cluster-connection name=...>
   ....
      <connector-ref>artemis-master-internal-and-external</connector-ref>
      <static-connectors>
         <connector-ref>artemis-slave</connector-ref>
      </static-connectors>
   </cluster-connection>
</cluster-connections>
{code}


was (Author: gtully):
I was thinking along the lines of two cluster connections (one that is 
configured to do very little but with the external dns conector-ref) and having 
an external and internal acceptor configured, the external acceptor linking to 
the 'external' connector ref. I don't think this will hang together b/c the 
topology internally is broker wide, and not tied to an acceptor, despite the 
possibility that an acceptor can link to a specific cluster connection.  Also, 
I don't think there is a way to separate topology from clustering data on a 
cluster connection at the moment.

However, peeking more and after having a chat with [~andytaylor], the 
connector-ref may still be the answer. 
I wonder if it would be possible to have the cluster connector-ref reference a 
failover uri with both the internal and external dns names?

{code}
<connectors>
   <connector 
name="artemis-master">tcp://internal-cluster-dns-1:61616</connector>
   <connector 
name="artemis-slave">tcp://internal-cluster-dns-2:61616</connector>

  <!-- expose external and internal dns to clients - reference this from the 
cluster-connecton.connector-ref -->
 <connector 
name="artemis-master-internal-and-external">failover:(tcp://internal-cluster-dns-1:61616,tcp://external-cluster-dns-1:61616)</connector>
</connectors> 
{code}
and share that as topology information, to both internal and external clients.

{code}
<cluster-connections>
   <cluster-connection name=...>
   ....
      <connector-ref>artemis-master-internal-and-external</connector-ref>
      <static-connectors>
         <connector-ref>artemis-slave</connector-ref>
      </static-connectors>
   </cluster-connection>
</cluster-connections>
{code}




> external clients cannot use cluster topology for HA or load balancing
> ---------------------------------------------------------------------
>
>                 Key: ARTEMIS-3640
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3640
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Vilius Šumskas
>            Assignee: Gary Tully
>            Priority: Major
>
> Let's say there is a simple Artemis HA master/slave shared storage cluster 
> with such configuration:
>  
> {noformat}
> <connectors>
>    <connector 
> name="artemis-master">tcp://internal-cluster-dns-1:61616</connector>
>    <connector 
> name="artemis-slave">tcp://internal-cluster-dns-2:61616</connector>
> </connectors>
> {noformat}
> The cluster is using static discovery.
>  
> Factory on internal clients are using:
> {noformat}
> (tcp://internal-cluster-dns-1:61616,tcp://internal-cluster-dns-2:61616)?ha=true&reconnectAttempts=30&useTopologyForLoadBalancing=false{noformat}
> Those internal clients can successfully connect to the cluster and failover 
> works as expected.
>  
> However if there is also external clients which use external DNS/IP address 
> of the cluster the topology doesn't return correct DNS name and the failover 
> fails.
> {noformat}
> (tcp://external-cluster-dns-1:61616,tcp://external-cluster-dns-2:61616)?ha=true&reconnectAttempts=30&useTopologyForLoadBalancing=false{noformat}
> {noformat}
> org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector: 
> AMQ214033: Cannot resolve host java.net.UnknownHostException: 
> internal-cluster-dns-1{noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to