Skip to main content

MarkLogic Server on Kubernetes

Configure the Administration Plane

In this example, HAProxy is configured to choose the MarkLogic node to connect to. Port routing is used, however, hostname routing can also be used.

### Administration Plane
     
## Access ML-0 node
## Access query console
 
frontend marklogic-0-8000
  mode http
  bind :81
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-0-8000
 
backend marklogic-0-8000
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8000-0 ml-cluster-marklogic-0.ml-cluster-marklogic-headless.ml.svc.cluster.local:8000 resolvers dns init-addr none cookie ml-cluster-marklogic-0-8000
 
## Access admin UI
 
frontend marklogic-0-8001
  mode http
  bind :82
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-0-8001
 
backend marklogic-0-8001
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8001-0 ml-cluster-marklogic-0.ml-cluster-marklogic-headless.ml.svc.cluster.local:8001 resolvers dns init-addr none cookie ml-cluster-marklogic-0-8001
 
## Access manage
 
frontend marklogic-0-8002
  mode http
  bind :83
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-0-8002
 
backend marklogic-0-8002
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8002-0 ml-cluster-marklogic-0.ml-cluster-marklogic-headless.ml.svc.cluster.local:8002 resolvers dns init-addr none cookie ml-cluster-marklogic-0-8002
 
# Access ML-1 node
 
## Access query console
 
frontend marklogic-1-8000
  mode http
  bind :84
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-1-8000
 
backend marklogic-1-8000
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8000-1 ml-cluster-marklogic-1.ml-cluster-marklogic-headless.ml.svc.cluster.local:8000 resolvers dns init-addr none cookie ml-cluster-marklogic-1-8000
 
## Access admin UI
 
frontend marklogic-1-8001
  mode http
  bind :85
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-1-8001
 
backend marklogic-1-8001
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8001-1 ml-cluster-marklogic-1.ml-cluster-marklogic-headless.ml.svc.cluster.local:8001 resolvers dns init-addr none cookie ml-cluster-marklogic-1-8001
 
## Access manage
 
frontend marklogic-1-8002
  mode http
  bind :86
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-1-8002
 
backend marklogic-1-8002
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8002-1 ml-cluster-marklogic-1.ml-cluster-marklogic-headless.ml.svc.cluster.local:8002 resolvers dns init-addr none cookie ml-cluster-marklogic-1-8002
 
# Access ML-2 node
 
## Access query console
 
frontend marklogic-2-8000
  mode http
  bind :87
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-2-8000
 
backend marklogic-2-8000
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8000-2 ml-cluster-marklogic-2.ml-cluster-marklogic-headless.ml.svc.cluster.local:8000 resolvers dns init-addr none cookie ml-cluster-marklogic-2-8000
 
## Access admin UI
 
frontend marklogic-2-8001
  mode http
  bind :88
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-2-8001
 
backend marklogic-2-8001
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8001-2 ml-cluster-marklogic-2.ml-cluster-marklogic-headless.ml.svc.cluster.local:8001 resolvers dns init-addr none cookie ml-cluster-marklogic-2-8001
 
## Access manage
 
frontend marklogic-2-8002
  mode http
  bind :89
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-2-8002
 
backend marklogic-2-8002
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8002-2 ml-cluster-marklogic-2.ml-cluster-marklogic-headless.ml.svc.cluster.local:8002 resolvers dns init-addr none cookie ml-cluster-marklogic-2-8002

Note

There is a frontend/backend section for each node + MarkLogic port to expose. For example, for the node ml-cluster-marklogic-2 on port 8002, the frontend section frontend marklogic-2-8002 is using the backend section backend marklogic-2-8002.

The code below shows the frontend bound on port 89 at the HAProxy level. Only the pod ml-cluster-marklogic-2 is used in the backend section.  There is one Ingress per HAProxy as the Administration Plane will be exposed:

## Access manage
 
frontend marklogic-2-8002
  mode http
  bind :89
  log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
  option httplog
  option forwardfor
 
  default_backend marklogic-2-8002
 
backend marklogic-2-8002
  mode http
  balance leastconn
  option forwardfor
  cookie haproxy insert indirect nocache maxidle 30m maxlife 4h
  stick-table type string len 32 size 10k expire 4h
  stick store-response res.cook(HostId)
  stick store-response res.cook(SessionId)
  stick match req.cook(HostId)
  stick match req.cook(SessionId)
  default-server check
  server ml-cluster-8002-2 ml-cluster-marklogic-2.ml-cluster-marklogic-headless.ml.svc.cluster.local:8002 resolvers dns init-addr none cookie ml-cluster-marklogic-2-8002
We bind the frontend on the port 89 at HAProxy level and only the pod ml-cluster-marklogic-2 is used in the backend section.