Кластер Artemis с jgroups и ssl: получение SocketTimeOutException - PullRequest
0 голосов
/ 19 июня 2020

Я установил кластер из 4 узлов: двух мастеров и двух подчиненных. Обнаружение осуществляется через jgroups и jdbc_pin g.

Теперь я хочу защитить его с помощью ssl . Поэтому я выполнил следующие команды и добавил файлы в пути к классам брокеров:

keytool -genkey -keystore activemq.example.keystore -storepass activemqexample -keypass activemqexample -dname "CN=ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA

keytool -export -keystore activemq.example.keystore -file server-side-cert.cer -storepass activemqexample

keytool -import -keystore activemq.example.truststore -file server-side-cert.cer -storepass activemqexample -keypass activemqexample -noprompt

Я также добавил свойство «true» в брокер. xml файл. Вот как это выглядит сейчас:

<security-enabled>true</security-enabled>

       <connectors>          
         <connector name="netty-connector">tcp://localhost:61616?sslEnabled=true;trustStorePath=activemq.example.truststore;trustStorePassword=activemqexample</connector>
       </connectors>

      <acceptors>            
         <acceptor name="netty-ssl-acceptor">tcp://localhost:61616?sslEnabled=true;keyStorePath=activemq.example.keystore;keyStorePassword=activemqexample</acceptor>
      </acceptors>


      <!-- failover config -->
        <ha-policy>
            <replication>
                <master>
                    <check-for-live-server>true</check-for-live-server>
                </master>
            </replication>   
        </ha-policy>

      <broadcast-groups>
         <broadcast-group name="my-broadcast-group">
            <broadcast-period>5000</broadcast-period>
            <jgroups-file>test-jgroups-jdbc_ping.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="my-discovery-group">
            <jgroups-file>test-jgroups-jdbc_ping.xml</jgroups-file>
            <jgroups-channel>active_broadcast_channel</jgroups-channel>
            <refresh-timeout>10000</refresh-timeout>
         </discovery-group>
      </discovery-groups>

      <cluster-connections>
         <cluster-connection name="my-cluster">
            <connector-ref>netty-connector</connector-ref>
            <retry-interval>500</retry-interval>
            <use-duplicate-detection>true</use-duplicate-detection>
            <message-load-balancing>ON_DEMAND</message-load-balancing>
            <max-hops>1</max-hops>
            <discovery-group-ref discovery-group-name="my-discovery-group"/>
         </cluster-connection>
      </cluster-connections>

Это файл jgroups:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="urn:org:jgroups"
    xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP recv_buf_size="${tcp.recv_buf_size:5M}"
     send_buf_size="${tcp.send_buf_size:5M}"
     max_bundle_size="64K"
     max_bundle_timeout="30"
     sock_conn_timeout="300"

     timer_type="new3"
     timer.min_threads="4"
     timer.max_threads="10"
     timer.keep_alive_time="3000"
     timer.queue_max_size="500"

     thread_pool.enabled="true"
     thread_pool.min_threads="2"
     thread_pool.max_threads="8"
     thread_pool.keep_alive_time="5000"
     thread_pool.queue_enabled="true"
     thread_pool.queue_max_size="10000"
     thread_pool.rejection_policy="discard"

     oob_thread_pool.enabled="true"
     oob_thread_pool.min_threads="1"
     oob_thread_pool.max_threads="8"
     oob_thread_pool.keep_alive_time="5000"
     oob_thread_pool.queue_enabled="false"
     oob_thread_pool.queue_max_size="100"
     oob_thread_pool.rejection_policy="discard"/>

     <TRACE/>

<JDBC_PING connection_url="jdbc:postgresql://127.0.0.1:5432/test" connection_username="test" connection_password="test" connection_driver="org.postgresql.Driver" initialize_sql="CREATE TABLE IF NOT EXISTS JGROUPSPING (own_addr varchar(200) ,bind_addr varchar(200),created timestamp DEFAULT CURRENT_TIMESTAMP,cluster_name varchar(200),ping_data BYTEA,constraint PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name))"/>

<MERGE3  min_interval="10000"
         max_interval="30000"/>
<FD_SOCK/>
<FD timeout="3000" max_tries="3" />
<VERIFY_SUSPECT timeout="1500"  />
<BARRIER />
<pbcast.NAKACK2 use_mcast_xmit="false"
                discard_delivered_msgs="true"/>
<UNICAST3 />
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
               max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="2000"
            view_bundling="true"/>
<MFC max_credits="2M"
     min_threshold="0.4"/>
<FRAG2 frag_size="60K"  />
<!--RSVP resend_interval="2000" timeout="10000"/-->
<pbcast.STATE_TRANSFER/>

Кластер работал с конфигурацией jgroups и без ssl ну. Но теперь с ssl я получаю SocketTimeOutException , когда запускаю главного брокера. С конфигурацией UDPBroadcas-Discovery вместо этого и ssl он как-то работает.

Это сообщение об ошибке:

SEVERE [org.jgroups.protocols.TCP] JGRP000029: D114336-43802: failed sending message to D114336-32899 (103 bytes): java.net.SocketTimeoutException: connect timed out, headers: GMS: GmsHeader[JOIN_REQ]: mbr=D114336-43802, UNICAST3: DATA, seqno=1, first, TP: [cluster_name=active_broadcast_channel]

Кто-нибудь может помочь? Есть ли проблема с jgroups?

...