You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "bob.sandiford@sirsidynix.com" <bo...@sirsidynix.com> on 2019/07/11 17:36:53 UTC
master / backup cluster-connection options not working?
Artemis 2.9.0. (as well as 2.6.3 where I first was testing).
I've got a working master / backup cluster, using static connectors. My
server broker.xml has these components:
<connectors>
<connector
name="master-connector">tcp://activemqmaster:61616</connector>
<connector
name="slave-connector">tcp://activemqbackup:61616</connector>
</connectors>
<acceptors>
<acceptor
name="netty-acceptor">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE;useEpoll=true</acceptor>
</acceptors>
<ha-policy>
<shared-store>
<master>
<failover-on-shutdown>true</failover-on-shutdown>
</master>
</shared-store>
</ha-policy>
<cluster-connections>
<cluster-connection name="${bc.core.deploy.env}-cluster">
<connector-ref>master-connector</connector-ref>
<static-connectors allow-direct-connections-only="true">
<connector-ref>slave-connector</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
I want to adjust the behaviour when (for example) master starts up and the
backup server isn't present. With the above, the master console just shows
exception after exception like this:
2019-07-11 15:38:45,750 ERROR [org.apache.activemq.artemis.core.client]
AMQ214016: Failed to create netty connection: java.net.UnknownHostException:
activemqbackup
activemqmaster_1 | at
java.net.InetAddress.getAllByName0(InetAddress.java:1281) [rt.jar:1.8.0_212]
every half second. (Well - twice every half second for some reason - there
seem to be two threads or something trying to connect to the backup server).
When I try to add options into the <cluster-connection>, some of them work,
some of them don't seem to work, and some cause compile errors when Artemis
starts up. For example, adding:
<retry-interval>2</retry-interval>
setting works - the retries go from every half second to every 2 seconds
(although there seem to be two threads trying to connect).
Adding:
<retry-interval-multiplier>1.5</retry-interval-multiplier>
doesn't seem to make any difference - the exceptions still come every 2
seconds.
Adding a
<initial-connect-attempts>3</initial-connect-attempts>
to try to limit the initial number of connection attempts yields an error
activemqmaster_1 | Caused by: org.xml.sax.SAXParseException;
cvc-complex-type.2.4.a: Invalid content was found starting with element
'initial-connect-attempts'. One of
'{"urn:activemq:core":use-duplicate-detection,
"urn:activemq:core":forward-when-no-consumers,
"urn:activemq:core":message-load-balancing, "urn:activemq:core":max-hops,
"urn:activemq:core":confirmation-window-size,
"urn:activemq:core":producer-window-size,
"urn:activemq:core":call-failover-timeout,
"urn:activemq:core":notification-interval,
"urn:activemq:core":notification-attempts,
"urn:activemq:core":scale-down-connector,
"urn:activemq:core":static-connectors,
"urn:activemq:core":discovery-group-ref}' is expected.
activemqmaster_1 | at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
when I look at the artemis-configuration.xsd, the "cluster-connectionType"
has "initial-connect-attempts" defined.
<xsd:element name="initial-connect-attempts" type="xsd:int"
default="-1" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
How many attempts should be made to connect initially
</xsd:documentation>
</xsd:annotation>
</xsd:element>
What I'm trying to get to is something like this:
<cluster-connections>
<cluster-connection name="${bc.core.deploy.env}-cluster">
<connector-ref>master-connector</connector-ref>
<retry-interval>2000</retry-interval>
<retry-interval-multiplier>1.5</retry-interval-multiplier>
<max-retry-interval>120000</max-retry-interval>
<reconnect-attempts>30</reconnect-attempts>
<initial-connect-attempts>30</initial-connect-attempts>
<static-connectors allow-direct-connections-only="true">
<connector-ref>slave-connector</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
Does anyone have any ideas on what I might be doing wrong?
Thanks!
--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Re: master / backup cluster-connection options not working?
Posted by "bob.sandiford@sirsidynix.com" <bo...@sirsidynix.com>.
Thanks, Justin. That does indeed allow me to start up without error.
However - some of the various options don't seem to do anything, as
indicated in the initial post.
For example - the multiplier doesn't seem to do anything - the reconnect
errors keep coming at 2000 ms intervals...
Any ideas on that?
Thanks!
--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Re: master / backup cluster-connection options not working?
Posted by Justin Bertram <jb...@apache.org>.
Try this syntax adjustment:
<cluster-connections>
<cluster-connection name="${bc.core.deploy.env}-cluster">
<connector-ref>master-connector</connector-ref>
<retry-interval>2000</retry-interval>
<retry-interval-multiplier>1.5</retry-interval-multiplier>
<max-retry-interval>120000</max-retry-interval>
<initial-connect-attempts>30</initial-connect-attempts>
<reconnect-attempts>30</reconnect-attempts>
<static-connectors allow-direct-connections-only="true">
<connector-ref>slave-connector</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
I swapped the order of <reconnect-attempts> and <initial-connect-attempts>.
The XSD wants the elements in <cluster-connection> to be in a particular
order. We should probably change that as it's not very user friendly.
Justin
On Thu, Jul 11, 2019 at 12:37 PM bob.sandiford@sirsidynix.com <
bob.sandiford@sirsidynix.com> wrote:
> Artemis 2.9.0. (as well as 2.6.3 where I first was testing).
>
> I've got a working master / backup cluster, using static connectors. My
> server broker.xml has these components:
>
> <connectors>
> <connector
> name="master-connector">tcp://activemqmaster:61616</connector>
> <connector
> name="slave-connector">tcp://activemqbackup:61616</connector>
> </connectors>
>
> <acceptors>
> <acceptor
> name="netty-acceptor">tcp://
> 0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE;useEpoll=true
> </acceptor>
> </acceptors>
>
> <ha-policy>
> <shared-store>
> <master>
> <failover-on-shutdown>true</failover-on-shutdown>
> </master>
> </shared-store>
> </ha-policy>
>
> <cluster-connections>
> <cluster-connection name="${bc.core.deploy.env}-cluster">
> <connector-ref>master-connector</connector-ref>
> <static-connectors allow-direct-connections-only="true">
> <connector-ref>slave-connector</connector-ref>
> </static-connectors>
> </cluster-connection>
> </cluster-connections>
>
> I want to adjust the behaviour when (for example) master starts up and the
> backup server isn't present. With the above, the master console just shows
> exception after exception like this:
>
> 2019-07-11 15:38:45,750 ERROR [org.apache.activemq.artemis.core.client]
> AMQ214016: Failed to create netty connection:
> java.net.UnknownHostException:
> activemqbackup
> activemqmaster_1 | at
> java.net.InetAddress.getAllByName0(InetAddress.java:1281)
> [rt.jar:1.8.0_212]
>
> every half second. (Well - twice every half second for some reason - there
> seem to be two threads or something trying to connect to the backup
> server).
>
> When I try to add options into the <cluster-connection>, some of them work,
> some of them don't seem to work, and some cause compile errors when Artemis
> starts up. For example, adding:
>
> <retry-interval>2</retry-interval>
>
> setting works - the retries go from every half second to every 2 seconds
> (although there seem to be two threads trying to connect).
>
> Adding:
>
> <retry-interval-multiplier>1.5</retry-interval-multiplier>
>
> doesn't seem to make any difference - the exceptions still come every 2
> seconds.
>
> Adding a
>
> <initial-connect-attempts>3</initial-connect-attempts>
>
> to try to limit the initial number of connection attempts yields an error
>
> activemqmaster_1 | Caused by: org.xml.sax.SAXParseException;
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'initial-connect-attempts'. One of
> '{"urn:activemq:core":use-duplicate-detection,
> "urn:activemq:core":forward-when-no-consumers,
> "urn:activemq:core":message-load-balancing, "urn:activemq:core":max-hops,
> "urn:activemq:core":confirmation-window-size,
> "urn:activemq:core":producer-window-size,
> "urn:activemq:core":call-failover-timeout,
> "urn:activemq:core":notification-interval,
> "urn:activemq:core":notification-attempts,
> "urn:activemq:core":scale-down-connector,
> "urn:activemq:core":static-connectors,
> "urn:activemq:core":discovery-group-ref}' is expected.
> activemqmaster_1 | at
>
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
>
> when I look at the artemis-configuration.xsd, the "cluster-connectionType"
> has "initial-connect-attempts" defined.
> <xsd:element name="initial-connect-attempts" type="xsd:int"
> default="-1" maxOccurs="1" minOccurs="0">
> <xsd:annotation>
> <xsd:documentation>
> How many attempts should be made to connect initially
> </xsd:documentation>
> </xsd:annotation>
> </xsd:element>
>
> What I'm trying to get to is something like this:
>
> <cluster-connections>
> <cluster-connection name="${bc.core.deploy.env}-cluster">
> <connector-ref>master-connector</connector-ref>
> <retry-interval>2000</retry-interval>
> <retry-interval-multiplier>1.5</retry-interval-multiplier>
> <max-retry-interval>120000</max-retry-interval>
> <reconnect-attempts>30</reconnect-attempts>
> <initial-connect-attempts>30</initial-connect-attempts>
> <static-connectors allow-direct-connections-only="true">
> <connector-ref>slave-connector</connector-ref>
> </static-connectors>
> </cluster-connection>
> </cluster-connections>
>
>
> Does anyone have any ideas on what I might be doing wrong?
>
> Thanks!
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>