Hi all,

     Just an update for anyone interested. I ditched the idea because there
are times the sessions are somehow just not copied correctly, and this is
just a 2 node cluster. As I am using AKS load balancer, I am not able to
use ip_hash for nginx.

     Instead I am now using redisson (I am not associated or affiliated to
them), and it seems to work for me so far.

Thanks.

Regards,
    Kok Hoor



On Thu, 18 Aug 2022 at 14:34, Chew Kok Hoor <kokh...@gmail.com> wrote:

> Hi Chris,
>
>     Following are my setup. It seems to work but I am not sure if I did
> things correctly:
>
>     1. In my server.xml, I followed the setup in javadoc
> https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/tribes/membership/cloud/DNSMembershipProvider.html
>  for
> the cluster tag.
>
>     2. In my service (not sure this is right or wrong),
>
>     - metadata.name is the name of my app appended with -membership.
>     - spec.ports.port I set to my connector port
>     - spec.selector.app I set it to the name of my app
>
>  apiVersion: v1
>  kind: Service
>  metadata:
>    annotations:
>      service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
>      description: "The service for tomcat cluster membership."
>    name: myapp-membership
>  spec:
>    clusterIP: None
>    ports:
>    - name: membership
>      port: 80
>    selector:
>      app: myapp
>
>     3. In my StatefulSet, I put the env settings in
> spec.template.spec.containers:
>
>         env:
>           - name: DNS_MEMBERSHIP_SERVICE_NAME
>             value: "myapp-membership"
>
> Still not sure if port 80 makes any sense (that's the port for my http
> listener which is loadbalanced by an nginx) but it seems to work.
>
> Thanks.
>
> Regards,
>     Kok Hoor
>
>
> [image: width=]
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free.www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_6135152540426665695_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Thu, 18 Aug 2022 at 02:37, Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> All,
>>
>> If you are havig issues with the CloudMembershipService, I would highly
>> recommend that you continue to have this discussion.
>>
>> The original author (remm) was mostly targeting OpenShift (he works for
>> RedHat, so it's not a surprise) but it doesn't mean that its support
>> cannot expand to include other deployments.
>>
>> If the DNSMembershipService is more appropriate for k8s-on-Azure, that's
>> fine, but if there is a community need (and especially if you are
>> willing to do the research and contribute code) we'd be happy to
>> accomodate you.
>>
>> -chris
>>
>> On 8/14/22 03:52, Chew Kok Hoor wrote:
>> > Hi,
>> >
>> >      I am trying to setup Tomcat clustering running in AKS, however the
>> > standard settings don't seem to work.
>> >
>> > As per the documentation I have setup following Cluster configuration in
>> > server.xml inside my <Host> tag:
>> >           <Cluster
>> className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
>> >             <Channel
>> > className="org.apache.catalina.tribes.group.GroupChannel">
>> >               <Membership
>> >
>> className="org.apache.catalina.tribes.membership.cloud.CloudMembershipService"/>
>> >             </Channel>
>> >           </Cluster>
>> >
>> > But I received a 'Failed connection to
>> > https://10.0.0.1:443/api/v1/namespaces/tomcat/pods' error. Is there
>> any way
>> > to resolve this?
>> >
>> > Error message:
>> >
>> > INFO: Cluster is about to start
>> > Aug 14, 2022 3:44:26 PM
>> org.apache.catalina.tribes.transport.ReceiverBase
>> > bind
>> > INFO: Receiver Server Socket bound to:[/10.240.0.76:4000]
>> > Aug 14, 2022 3:44:26 PM
>> > org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider
>> > getNamespace
>> > WARNING: Namespace not set
>> > Aug 14, 2022 3:44:26 PM
>> > org.apache.catalina.tribes.membership.cloud.KubernetesMembershipProvider
>> > fetchMembers
>> > SEVERE: Failed to open stream
>> > java.io.IOException: Failed connection to [
>> > https://10.0.0.1:443/api/v1/namespaces/tomcat/pods] with token
>> > [--redacted--]
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.TokenStreamProvider.openStream(TokenStreamProvider.java:56)
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.KubernetesMembershipProvider.fetchMembers(KubernetesMembershipProvider.java:136)
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider.heartbeat(CloudMembershipProvider.java:127)
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.KubernetesMembershipProvider.start(KubernetesMembershipProvider.java:116)
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.CloudMembershipService.start(CloudMembershipService.java:152)
>> >          at
>> >
>> org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:192)
>> >          at
>> >
>> org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:106)
>> >          at
>> >
>> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:190)
>> >          at
>> >
>> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:190)
>> >          at
>> >
>> org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:224)
>> >          at
>> >
>> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:190)
>> >          at
>> >
>> org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:504)
>> >          at
>> >
>> org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:564)
>> >          at
>> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>> >          at
>> >
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:908)
>> >          at
>> >
>> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
>> >          at
>> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>> >          at
>> >
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
>> >          at
>> >
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
>> >          at java.base/java.util.concurrent.FutureTask.run(Unknown
>> Source)
>> >          at
>> >
>> org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
>> >          at
>> > java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown
>> > Source)
>> >          at
>> >
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
>> >          at
>> >
>> org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
>> >          at
>> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>> >          at
>> >
>> org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
>> >          at
>> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>> >          at
>> >
>> org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
>> >          at
>> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>> >          at
>> org.apache.catalina.startup.Catalina.start(Catalina.java:772)
>> >          at
>> > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > Method)
>> >          at
>> > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
>> > Source)
>> >          at
>> >
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> > Source)
>> >          at java.base/java.lang.reflect.Method.invoke(Unknown Source)
>> >          at
>> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
>> >          at
>> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
>> > Caused by: java.io.IOException: Server returned HTTP response code: 403
>> for
>> > URL: https://10.0.0.1:443/api/v1/namespaces/tomcat/pods
>> >          at
>> >
>> java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown
>> > Source)
>> >          at
>> >
>> java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
>> > Source)
>> >          at
>> >
>> java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown
>> > Source)
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.AbstractStreamProvider.openStream(AbstractStreamProvider.java:110)
>> >          at
>> >
>> org.apache.catalina.tribes.membership.cloud.TokenStreamProvider.openStream(TokenStreamProvider.java:53)
>> >          ... 35 more
>> >
>> > Aug 14, 2022 3:44:27 PM
>> org.apache.catalina.ha.session.JvmRouteBinderValve
>> > startInternal
>> > INFO: JvmRouteBinderValve started
>> >
>> > Thanks.
>> >
>> > Regards,
>> >      Kok Hoor
>> >
>> > [image: width=]
>> > <
>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
>> >
>> > Virus-free.www.avast.com
>> > <
>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
>> >
>> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>

Reply via email to