Skip to content

Commit

Permalink
Merge branch 'main' into update-ha-network-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
antejavor authored Nov 28, 2024
2 parents 3e41c2e + 4f174b9 commit c1ddd84
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
20 changes: 18 additions & 2 deletions charts/memgraph-high-availability/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Helm chart for Memgraph high availability cluster (Enterprise)
A Helm Chart for deploying Memgraph in [high availability setup](https://memgraph.com/docs/clustering/high-availability). This helm chart requires an enterprise version of Memgraph.
# Helm chart for Memgraph high availability (HA) cluster (Enterprise)
A Helm Chart for deploying Memgraph in [high availability setup](https://memgraph.com/docs/clustering/high-availability). This Helm Chart requires an [Enterprise version of Memgraph](https://memgraph.com/docs/database-management/enabling-memgraph-enterprise).

Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability".
The cluster is started in the configuration without the node selector, which means that in the current configuration, it is not highly available if the node fails.
Expand All @@ -21,11 +21,24 @@ Or you can modify a `values.yaml` file and override the desired values:
helm install <release-name> memgraph/memgraph-high-availability -f values.yaml
```

## Running the Memgraph HA Helm Chart locally

To run Memgraph HA Helm Chart locally, affinity needs to be disabled because the cluster will be running on a single node.

To disable the affinity, run the following command with the specified set of flags:

```
helm install <release-name> memgraph/memgraph-high-availability --set memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE=<your-license>,memgraph.env.MEMGRAPH_ORGANIZATION_NAME=<your-organization-name>,memgraph.affinity.enabled=false
```

The affinity is disabled either by running the command above, or by modifying the `values.yaml` file.


## Configuration Options

The following table lists the configurable parameters of the Memgraph chart and their default values.


| Parameter | Description | Default |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------|
| `memgraph.image.repository` | Memgraph Docker image repository | `memgraph/memgraph` |
Expand Down Expand Up @@ -55,6 +68,8 @@ The following table lists the configurable parameters of the Memgraph chart and
| `memgraph.ports.coordinatorPort` | Coordinator port used on coordinators. | `12000` |
| `data` | Configuration for data instances | See `data` section |
| `coordinators` | Configuration for coordinator instances | See `coordinators` section |
| `sysctlInitContainer.enabled` | Enable the init container to set sysctl parameters | `true` |
| `sysctlInitContainer.maxMapCount` | Value for `vm.max_map_count` to be set by the init container | `262144` |

For the `data` and `coordinators` sections, each item in the list has the following parameters:

Expand All @@ -63,6 +78,7 @@ For the `data` and `coordinators` sections, each item in the list has the follow
| `id` | ID of the instance | `0` for data, `1` for coordinators |
| `args` | List of arguments for the instance | See `args` section |


The `args` section contains a list of arguments for the instance. The default values are the same for all instances:

```markdown
Expand Down
9 changes: 9 additions & 0 deletions charts/memgraph-high-availability/templates/coordinators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ spec:
add: [ "CHOWN" ]
runAsUser: 0
runAsNonRoot: false
{{- if $.Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}

containers:
- name: memgraph-coordinator
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
Expand Down
9 changes: 9 additions & 0 deletions charts/memgraph-high-availability/templates/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ spec:
add: [ "CHOWN" ]
runAsUser: 0
runAsNonRoot: false
{{- if $.Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}

containers:
- name: memgraph-data
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
Expand Down
7 changes: 7 additions & 0 deletions charts/memgraph-high-availability/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ memgraph:
coordLoadBalancer:
enabled: true

# If you are experiencing issues with the sysctlInitContainer, you can disable it here.
# This is made to increase the max_map_count, necessary for high memory loads in Memgraph
# If you are experiencing crashing pod with the: Max virtual memory areas vm.max_map_count is too low
# you can increase the maxMapCount value.
sysctlInitContainer:
enabled: true
maxMapCount: 262144

data:
- id: "0"
Expand Down
3 changes: 2 additions & 1 deletion charts/memgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ The following table lists the configurable parameters of the Memgraph chart and
| `probes.startup.failureThreshold` | Failure threshold for startup probe | `30` |
| `nodeSelectors` | Node selectors for pod. Left empty by default. | `{}` |
| `customQueryModules` | List of custom Query modules that should be mounted to Memgraph Pod | `[]` |

| `sysctlInitContainer.enabled` | Enable the init container to set sysctl parameters | `true` |
| `sysctlInitContainer.maxMapCount` | Value for `vm.max_map_count` to be set by the init container | `262144` |
**Note:** It's often recommended not to specify default resources and leave it as a conscious choice for the user. If you want to specify resources, uncomment the following lines in your `values.yaml`, adjust them as necessary:

```yaml
Expand Down
9 changes: 8 additions & 1 deletion charts/memgraph/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ spec:
add: ["CHOWN"]
runAsUser: 0
runAsNonRoot: false

{{- if .Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ .Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}
terminationGracePeriodSeconds: {{ .Values.container.terminationGracePeriodSeconds }}
securityContext:
{{- if .Values.useImagePullSecrets }}
Expand Down
11 changes: 10 additions & 1 deletion charts/memgraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ affinity:
nodeKey:
nodeValue:


nodeSelector: {}

tolerations: []
Expand Down Expand Up @@ -120,7 +121,6 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""


container:
terminationGracePeriodSeconds: 1800
probes:
Expand All @@ -145,3 +145,12 @@ customQueryModules: []
# - volume: ""
# Must be present in the ConfigMap referenced with `volume`
# file: ""


# If you are experiencing issues with the sysctlInitContainer, you can disable it here.
# This is made to increase the max_map_count, necessary for high memory loads in Memgraph
# If you are experiencing crashing pod with the: Max virtual memory areas vm.max_map_count is too low
# you can increase the maxMapCount value.
sysctlInitContainer:
enabled: true
maxMapCount: 262144

0 comments on commit c1ddd84

Please sign in to comment.