ActiveMQ Artemis: 클라이언트가 브로커 클러스터 포트에 연결됩니다.

ActiveMQ Artemis: 클라이언트가 브로커 클러스터 포트에 연결됩니다.

클러스터 구성에서 실행되는 ActiveMQ Artemis(v2.14.0) 브로커에 일부 JMS 클라이언트를 연결하고 있습니다. 오늘 우리는 클라이언트가 클러스터 통신 전용인 수락자에 연결하고 왜 그런 일이 발생하는지 궁금해하는 것을 발견했습니다.

관련 broker.xml스니펫은 다음과 같습니다.

<configuration xmlns="urn:activemq" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
  <core xmlns="urn:activemq:core" xsi:schemaLocation="urn:activemq:core ">
    […]
    <connectors>
      <connector name="netty-connector">tcp://${ipv4addr:localhost}:61618?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;useEpoll=true</connector>
    </connectors>
    <acceptors>
      <!-- Acceptor for every supported protocol -->
      <acceptor name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true;connectionsAllowed=10000</acceptor>
      <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
      <acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true</acceptor>
      <!-- STOMP Acceptor. -->
      <acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true</acceptor>
      <!-- HornetQ Compatibility Acceptor.  Enables HornetQ Core and STOMP for legacy HornetQ clients. -->
      <acceptor name="hornetq">tcp://0.0.0.0:5445?anycastPrefix=jms.queue.;multicastPrefix=jms.topic.;protocols=HORNETQ,STOMP;useEpoll=true</acceptor>
      <!-- MQTT Acceptor -->
      <acceptor name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true</acceptor>
      <acceptor name="netty-acceptor">tcp://0.0.0.0:61618?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;useEpoll=true</acceptor>
      <acceptor name="artemis-tls">tcp://0.0.0.0:61617?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true;sslEnabled=true;keyStorePath=/var/lib/artemis/certs/keystore.jks;keyStorePassword=${keyStorePassword};enabledProtocols=TLSv1.2</acceptor>
    </acceptors>
    <broadcast-groups>
      <broadcast-group name="cluster-broadcast-group">
        <broadcast-period>5000</broadcast-period>
        <jgroups-file>jgroups.xml</jgroups-file>
        <jgroups-channel>active_broadcast_channel</jgroups-channel>
        <connector-ref>netty-connector</connector-ref>
      </broadcast-group>
    </broadcast-groups>
    <discovery-groups>
      <discovery-group name="cluster-discovery-group">
        <jgroups-file>jgroups.xml</jgroups-file>
        <jgroups-channel>active_broadcast_channel</jgroups-channel>
        <refresh-timeout>10000</refresh-timeout>
      </discovery-group>
    </discovery-groups>
    <cluster-connections>
      <cluster-connection name="artemis-cluster">
        <connector-ref>netty-connector</connector-ref>
        <retry-interval>500</retry-interval>
        <use-duplicate-detection>true</use-duplicate-detection>
        <message-load-balancing>STRICT</message-load-balancing>
        <!-- <address>jms</address> -->
        <max-hops>1</max-hops>
        <discovery-group-ref discovery-group-name="cluster-discovery-group"/>
        <!-- <forward-when-no-consumers>true</forward-when-no-consumers> -->
      </cluster-connection>
    </cluster-connections>
  </core>
</configuration>

클라이언트 연결에 포트 61616(일반 TCP, acceptor artemis) 및 61617(TLS, acceptor ) 을 사용하려는 의도입니다 . artemis-tls브로커는 netty-acceptor클러스터 내부 통신에 포트 61618(수락자)을 사용해야 합니다. 그러나 토폴로지 검색 중에 브로커는 예상 포트 61616 대신 포트 61618을 클라이언트에 다시 보냅니다. 모든 통신이 일반 TCP인 경우에는 작동하지만 netty-acceptor클라이언트 연결이 아닌 TLS용으로 구성 하면 상황이 이상해집니다 . 그러면 클라이언트는 다음과 같은 메시지를 표시합니다.

2020-08-24 17:58:13,833 | WARN  | Thread-1 (ActiveMQ-client-netty-threads) | i.n.c.ChannelInitializer | Failed to initialize a channel. Closing: [id: 0x5bb533bc]

java.lang.Exception: Failed to find a store at /var/lib/artemis/certs/truststore.jks

    at org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport.validateStoreURL(SSLSupport.java:278)

따라서 브로커는 내부 구성을 클라이언트에 전달합니다. ( /var/lib/artemis/certs/truststore.jksArtemis 컨테이너에만 존재합니다.)

전용 클라이언트 및 클러스터 연결을 위해 브로커를 구성하고 클라이언트가 클러스터 엔드포인트를 수신하지 않도록 하려면 어떻게 해야 합니까? 또한 클라이언트 및 클러스터 연결에 대해 TLS를 독립적으로 구성할 수 있습니까? 여기서 문서는 실제로 도움이 되지 않습니다.

편집하다

이 문제를 다시 생각해 보면 다음과 같은 관련 질문이 생깁니다. TCP를 통해 연결하는 클라이언트가 검색 중에 항상 TCP 포트를 수신하고 TLS를 통해 연결하는 클라이언트가 TLS 포트를 수신하는지 확인하는 방법은 무엇입니까?

업데이트

자세히 살펴보면아르테미스 문서이 설명을 공개합니다.

이 값은 서버에서 구성할 수 있지만 클라이언트에서 다운로드하여 사용합니다.

좋아요, 그게 조금 설명이 됩니다. 그러나 클라이언트에게 어떤 커넥터를 사용할지 알려주는 방법을 여전히 알 수 없습니다. 에서레드햇 AMQ 7.2문서, 6.3장에 따르면

위의 커넥터는 지정된 IP 및 포트 10.10.10.2:61617에 TCP 연결을 설정할 때 클라이언트 또는 브로커 자체에서 참조됩니다.

클라이언트가 IP 주소와 포트를 일치시켜 적절한 커넥터를 찾도록 제안합니다. 그러나 이는 Artemis v2.14.0에서는 작동하지 않는 것 같습니다.

관련 정보