Configuration
The HAProxy configuration is designed to be as dynamic as possible. The configuration works efficiently with MarkLogic and should not require any modification. The configuration is separated into five sections:
Global
Default
Resolver DNS
Front-ends
Back-ends
Global section
The default HAProxy is configured to handle 1024 parallel connections. Log output is done through the container stdout
and can be checked using the kubectl
log command.
Default section
timeout
is set at 600s to fit with the default timeout on MarkLogic. By default, the HAProxy will forward the client IP to MarkLogic.
To modify timeout
, change the configuration in the values.yaml
file:
timeout: timeoutClient: 600s timeoutConnect: 600s timeoutServer: 600s
Resolver DNS
This section mainly handles the DNS configuration between HAProxy and MarkLogic server.
Front-end section
HAProxy statistics pages
The statistics page is disabled by default. It can be exposed by providing this configuration in the values.yaml
file of the chart:
stats: enabled: false port: 1024 auth: enabled: false username: '' password: ''
Then, a dedicated front-end section can be configured.
MarkLogic front-end
Two different front-end types can be configured:
HTTP
TCP
The HTTP front-end can be configured using path-based routing or port routing. See Set up and use path-based routing with MarkLogic Helm Chart for configuration information.
Note
Path-based routing is only supported in MarkLogic 11.1 and higher.
TCP front-end
By default, HAProxy uses the leastconn algorithm. HAProxy selects the server with the fewest active sessions. The logs are standard TCP output which is the recommended value for a pure TCP connection. The TCP front-end allows the exposure of ODBC servers from MarkLogic.
To add port 5432 for TCP load balancing, add this configuration to the values.yam
l file:
tcpports: # TCP port has to be explicitely enabled enabled: true ports: - name: odbc type: TCP port: 5432
HTTP front-end
The HTTP front-ends are all configured in the same way. When path-based routing is enabled, only one front-end section is created. Each request is handled by the relevant MarkLogic server based on the path used. When path-based routing is not enabled, then a dedicated front-end section is created for each port exposed.
This is the default configuration:
# Path and port used on HAProxy # The same path will be used on Ingress for Default AppServers defaultAppServers: appservices: path: /console port: 8000 admin: path: /adminUI port: 8001 manage: path: /manage port: 8002
To add port 8010 for HTTP load balancing, add this configuration to the values.yaml
file:
additionalAppServers: - name: myapp1 type: HTTP port: 8010 targetPort: 8010 path: /myapp1
Back-end section
HTTP back-ends are all configured in the same way. By default, HAProxy uses the leastconn algorithm. HAProxy selects the server with the fewest active sessions.
Specific cookies are managed to bring session stickiness capability.
The
HostId
cookie is used for XCC connections.The
SessionID
cookie is used for the Java client.A dedicated cookie is used to manage requests made through the internet browser.
Cookies are set to expired all 4 hours.