Skip to main content

MarkLogic Server on Kubernetes

MarkLogic Load Balancer configuration

The MarkLogic Load Balancer in the Helm chart can manage TCP connections:

    {{- if eq $portType "TCP"  -}}
      listen odbc
        bind :{{ $portNumber }}
        mode tcp
        balance leastconn
        {{- range $i := until $replicas }}
        server {{ printf "ml-%s-%s-%v" $releaseName $portNumber $i }} 
        {{ $releaseName }}-{{ $i }}.{{ $releaseName }}-headless.
        {{ $namespace }}.svc.{{ $clusterDomain }}:{{ $portNumber }} 
        check resolvers dns init-addr none
        {{- end }}
    {{- else if eq $portType "HTTP" }}

These connections are managed via the values.yaml file.

## ports and load balancing type configuration for HAproxy
  ## There are three types of backends supported:
  ## 1. HTTP: HTTP(Layer 7) proxy mode. This works for most of the App Servers 
     handling HTTP connections.
  ## 2. TCP: TCP(Layer 4) proxy mode. This works for the MarkLogic App Servers 
     handling TCP connections like ODBC.  
  ports:
    - name: app-service
      type: HTTP
      port: 8000
      targetPort: 8000
    - name: admin
      type: HTTP
      port: 8001
      targetPort: 8001
    - name: manage
      type: HTTP
      port: 8002
      targetPort: 8002
    # - name: odbc
    #   type: TCP
    #   port: 5432

Code Explanation

Code

Description

mode tcp

TCP is set because a layer 4 load balancer is required for ODBC connections.

balance leastconn

This setting selects the servers with the fewest active sessions.