Class DNSMembershipProvider

  • All Implemented Interfaces:
    ChannelListener, Heartbeat, MembershipProvider

    public class DNSMembershipProvider
    extends CloudMembershipProvider
    A MembershipProvider that uses DNS to retrieve the members of a cluster.

    Configuration example for Kubernetes

    server.xml
     
     <Server ...
    
       <Service ...
    
         <Engine ...
    
           <Host ...
    
             <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"
                     membershipProviderClassName="org.apache.catalina.tribes.membership.cloud.DNSMembershipProvider"/>
               </Channel>
             </Cluster>
             ...
      
      
    dns-membership-service.yml
     
     apiVersion: v1
     kind: Service
     metadata:
       annotations:
         service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
         description: "The service for tomcat cluster membership."
       name: my-tomcat-app-membership
     spec:
       clusterIP: None
       ports:
       - name: membership
         port: 8888
       selector:
         app: my-tomcat-app
     
     
    Environment variable configuration
    DNS_MEMBERSHIP_SERVICE_NAME=my-tomcat-app-membership