为什么activemq自己打开套接字
Why does activemq opening sockets with itself
我遇到了这种情况,其中我试图 运行 使用 SSL 的 activemq,但我看到了 SSL 异常。
这是我的 activemq.xml
.
的除外
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:${JMS_PORT}" />
<transportConnector name="stomp" uri="stomp://0.0.0.0:${JMS_STOMP_PORT}"/>
<transportConnector name="ssl" uri="ssl://0.0.0.0:${JMS_SSL_PORT}"/>
</transportConnectors>
<sslContext>
<sslContext
keyStore="file:${JMS_KEY_STORE}"
keyStorePassword="${JMS_KEY_STORE_PASSWORD}"
trustStore="file:${JMS_TRUST_STORE}"
trustStorePassword="${JMS_TRUST_STORE_PASSWORD}"
/>
</sslContext>
<networkConnectors>
<networkConnector
name="host1 and host2"
uri="static://(${JMS_X_SITE_CSV_URL})?wireFormat=ssl&wireFormat.maxInactivityDuration=30000"
dynamicOnly="true"
suppressDuplicateQueueSubscriptions = "true"
networkTTL="1"
/>
</networkConnectors>
变量的值如下。
JMS_PORT=10029
JMS_STOMP_PORT=10030
JMS_SSL_PORT=10031
JMS_X_SITE_CSV_URL=tcp://localhost:10031/
现在,通过上述配置,我看到 javax.net.ssl.SSLException
的错误如下:
2016-09-20 14:47:48,619 | ERROR | Could not accept connection from tcp://localhost:54869: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-3
2016-09-20 14:47:49,628 | ERROR | Could not accept connection from tcp://localhost:54871: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-9
2016-09-20 14:47:51,639 | ERROR | Could not accept connection from tcp://localhost:54893: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-12
2016-09-20 14:47:55,645 | ERROR | Could not accept connection from tcp://localhost:54902: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-20
2016-09-20 14:48:03,653 | ERROR | Could not accept connection from tcp://localhost:54906: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-31
2016-09-20 14:48:19,661 | ERROR | Could not accept connection from tcp://localhost:54915: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-50
错误消息起初看起来很神秘,但后来就明白了。当我实际尝试连接到 SSL 端口 -10031
时,我使用 tcp://
配置了网络连接器。此问题导致套接字保留在 CLOSE_WAIT
中,从而为 ActiveMQ 本身使用了大量内存。
下面是悬空套接字在出现问题时的样子。
tcp6 0 0 127.0.0.1:54869 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 0 0 127.0.0.1:54871 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 1 0 127.0.0.1:54893 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 0 0 127.0.0.1:54902 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 1 0 127.0.0.1:54915 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 1 0 127.0.0.1:54922 127.0.0.1:10031 CLOSE_WAIT 4807/java
So, I fixed the JMS_X_SITE_CSV_URL
to ssl://localhost:10031/
and the issue was resolved.
现在,这是我的问题(很抱歉来到这里的冗长解释)。
Why was activemq opening sockets with itself?
我在解决这个问题时在想,套接字被 producers/consumers 打开,同时试图 read/write 数据离开队列,但是当我只是 运行ning activemq 进程(没有其他 java 进程)以隔离它正在打开与自身的连接。
0.0.0.0
表示activemq会监听所有可用的接口,包括127.0.0.1
。有关详细信息,请参阅 What is the difference between 0.0.0.0, 127.0.0.1 and localhost?
由于配置块,ActiveMQ 正在尝试连接到它自己的代理 - networkConnector
。
To provide massive scalability of a large messaging fabric you
typically want to allow many brokers to be connected together into a
network so that you can have as many clients as you wish all logically
connected together - and running as many message brokers as you need
based on your number of clients and network topology.
http://activemq.apache.org/networks-of-brokers.html
因为,我已经将 JMS_X_SITE_CSV_URL
配置为本地主机,activemq 正在尝试连接到它自己的代理。
关于此的更多详细信息 -
我遇到了这种情况,其中我试图 运行 使用 SSL 的 activemq,但我看到了 SSL 异常。
这是我的 activemq.xml
.
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:${JMS_PORT}" />
<transportConnector name="stomp" uri="stomp://0.0.0.0:${JMS_STOMP_PORT}"/>
<transportConnector name="ssl" uri="ssl://0.0.0.0:${JMS_SSL_PORT}"/>
</transportConnectors>
<sslContext>
<sslContext
keyStore="file:${JMS_KEY_STORE}"
keyStorePassword="${JMS_KEY_STORE_PASSWORD}"
trustStore="file:${JMS_TRUST_STORE}"
trustStorePassword="${JMS_TRUST_STORE_PASSWORD}"
/>
</sslContext>
<networkConnectors>
<networkConnector
name="host1 and host2"
uri="static://(${JMS_X_SITE_CSV_URL})?wireFormat=ssl&wireFormat.maxInactivityDuration=30000"
dynamicOnly="true"
suppressDuplicateQueueSubscriptions = "true"
networkTTL="1"
/>
</networkConnectors>
变量的值如下。
JMS_PORT=10029
JMS_STOMP_PORT=10030
JMS_SSL_PORT=10031
JMS_X_SITE_CSV_URL=tcp://localhost:10031/
现在,通过上述配置,我看到 javax.net.ssl.SSLException
的错误如下:
2016-09-20 14:47:48,619 | ERROR | Could not accept connection from tcp://localhost:54869: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-3
2016-09-20 14:47:49,628 | ERROR | Could not accept connection from tcp://localhost:54871: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-9
2016-09-20 14:47:51,639 | ERROR | Could not accept connection from tcp://localhost:54893: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-12
2016-09-20 14:47:55,645 | ERROR | Could not accept connection from tcp://localhost:54902: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-20
2016-09-20 14:48:03,653 | ERROR | Could not accept connection from tcp://localhost:54906: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-31
2016-09-20 14:48:19,661 | ERROR | Could not accept connection from tcp://localhost:54915: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[divinedragonbox] Task-50
错误消息起初看起来很神秘,但后来就明白了。当我实际尝试连接到 SSL 端口 -10031
时,我使用 tcp://
配置了网络连接器。此问题导致套接字保留在 CLOSE_WAIT
中,从而为 ActiveMQ 本身使用了大量内存。
下面是悬空套接字在出现问题时的样子。
tcp6 0 0 127.0.0.1:54869 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 0 0 127.0.0.1:54871 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 1 0 127.0.0.1:54893 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 0 0 127.0.0.1:54902 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 1 0 127.0.0.1:54915 127.0.0.1:10031 CLOSE_WAIT 4807/java
tcp6 1 0 127.0.0.1:54922 127.0.0.1:10031 CLOSE_WAIT 4807/java
So, I fixed the
JMS_X_SITE_CSV_URL
tossl://localhost:10031/
and the issue was resolved.
现在,这是我的问题(很抱歉来到这里的冗长解释)。
Why was activemq opening sockets with itself?
我在解决这个问题时在想,套接字被 producers/consumers 打开,同时试图 read/write 数据离开队列,但是当我只是 运行ning activemq 进程(没有其他 java 进程)以隔离它正在打开与自身的连接。
0.0.0.0
表示activemq会监听所有可用的接口,包括127.0.0.1
。有关详细信息,请参阅 What is the difference between 0.0.0.0, 127.0.0.1 and localhost?
由于配置块,ActiveMQ 正在尝试连接到它自己的代理 - networkConnector
。
To provide massive scalability of a large messaging fabric you typically want to allow many brokers to be connected together into a network so that you can have as many clients as you wish all logically connected together - and running as many message brokers as you need based on your number of clients and network topology.
http://activemq.apache.org/networks-of-brokers.html
因为,我已经将 JMS_X_SITE_CSV_URL
配置为本地主机,activemq 正在尝试连接到它自己的代理。
关于此的更多详细信息 -