Skip to content

Commit

Permalink
Improvements for Memgraph 2.18.1 (#43)
Browse files Browse the repository at this point in the history
Several improvements:
- Coordinators can now finally be restarted in Kubernetes meaning we finally have fault-tolerant coordinators 
- Management server is added to coordinators
- NuRaft logs are added
- Logs are persisted
- All probes are removed since we have to figure out how they will cooperate with coordinator restarts
- Version is bumped to 2.18.1
  • Loading branch information
as51340 authored Jul 18, 2024
1 parent e485e57 commit 1617882
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 59 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lint-test-high-availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
continue-on-error: true

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_store
docker/
2 changes: 1 addition & 1 deletion charts/memgraph-high-availability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 |
| `boltPort` | Bolt port of the instance | `7687` |
| `managementPort` (data only) | Management port of the data instance | `10000` |
| `managementPort` | Management port of the data instance | `10000` |
| `replicationPort` (data only) | Replication port of the data instance | `20000` |
| `coordinatorPort` (coordinators only) | Coordinator port of the coordinator instance | `12000` |
| `args` | List of arguments for the instance | See `args` section |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
spec:
containers:
- name: memgraph-setup
image: memgraph/memgraph:2.17.0
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
command: ["/bin/bash", "-c"]
args:
- |
Expand All @@ -28,8 +28,8 @@ spec:
# Run the mgconsole commands
echo "Running mgconsole commands..."
echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:7687", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:7687", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:7687", "management_server": "memgraph-coordinator-2.default.svc.cluster.local:10000", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:7687", "management_server": "memgraph-coordinator-3.default.svc.cluster.local:10000", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:10000", "replication_server": "memgraph-data-0.default.svc.cluster.local:20000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7687", "management_server": "memgraph-data-1.default.svc.cluster.local:10000", "replication_server": "memgraph-data-1.default.svc.cluster.local:20000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
Expand Down
28 changes: 3 additions & 25 deletions charts/memgraph-high-availability/templates/coordinators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ spec:
imagePullPolicy: {{ $.Values.memgraph.image.pullPolicy }}
ports:
- containerPort: {{ $coordinator.boltPort }}
- containerPort: {{ $coordinator.managementPort }}
- containerPort: {{ $coordinator.coordinatorPort }}
args:
{{- range $arg := $coordinator.args }}
Expand All @@ -52,30 +53,6 @@ spec:
value: "{{ $.Values.memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE }}"
- name: MEMGRAPH_ORGANIZATION_NAME
value: "{{ $.Values.memgraph.env.MEMGRAPH_ORGANIZATION_NAME }}"
livenessProbe:
exec:
command:
- sh
- -c
- echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }}
initialDelaySeconds: {{ $.Values.memgraph.probes.liveness.initialDelaySeconds }}
periodSeconds: {{ $.Values.memgraph.probes.liveness.periodSeconds }}
readinessProbe:
exec:
command:
- sh
- -c
- echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }}
initialDelaySeconds: {{ $.Values.memgraph.probes.readiness.initialDelaySeconds }}
periodSeconds: {{ $.Values.memgraph.probes.readiness.periodSeconds }}
startupProbe:
exec:
command:
- sh
- -c
- echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }}
failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }}
periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }}
volumeMounts:
{{- if $.Values.memgraph.coordinators.volumeClaim.storagePVC }}
- name: memgraph-coordinator-{{ $coordinator.id }}-lib-storage
Expand All @@ -99,6 +76,7 @@ spec:
requests:
storage: {{ $.Values.memgraph.coordinators.volumeClaim.storagePVCSize }}
{{- end }}

{{- if $.Values.memgraph.coordinators.volumeClaim.logPVC }}
- metadata:
name: memgraph-coordinator-{{ $coordinator.id }}-log-storage
Expand All @@ -110,7 +88,7 @@ spec:
{{- end }}
resources:
requests:
storage: {{ $.Values.memgraph.coordinators.volumeClaim.storagePVC.logPVCSize }}
storage: {{ $.Values.memgraph.coordinators.volumeClaim.logPVCSize }}
{{- end }}
---
{{- end }}
24 changes: 0 additions & 24 deletions charts/memgraph-high-availability/templates/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,6 @@ spec:
value: "{{ $.Values.memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE }}"
- name: MEMGRAPH_ORGANIZATION_NAME
value: "{{ $.Values.memgraph.env.MEMGRAPH_ORGANIZATION_NAME }}"
livenessProbe:
exec:
command:
- sh
- -c
- echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }}
initialDelaySeconds: {{ $.Values.memgraph.probes.liveness.initialDelaySeconds }}
periodSeconds: {{ $.Values.memgraph.probes.liveness.periodSeconds }}
readinessProbe:
exec:
command:
- sh
- -c
- echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }}
initialDelaySeconds: {{ $.Values.memgraph.probes.readiness.initialDelaySeconds }}
periodSeconds: {{ $.Values.memgraph.probes.readiness.periodSeconds }}
startupProbe:
exec:
command:
- sh
- -c
- echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }}
failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }}
periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }}
volumeMounts:
{{- if $.Values.memgraph.data.volumeClaim.storagePVC }}
- name: memgraph-data-{{ $data.id }}-lib-storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ spec:
name: coordinator
port: {{ .coordinatorPort }}
targetPort: {{ .coordinatorPort }}
- protocol: TCP
name: management
port: {{ .managementPort }}
targetPort: {{ .managementPort }}
{{- end }}

# Service for coordinators instances external
Expand All @@ -34,6 +38,6 @@ spec:
ports:
- protocol: TCP
name: bolt
port: 7687
targetPort: 7687
port: {{ .boltPort }}
targetPort: {{ .boltPort }}
{{- end }}
22 changes: 18 additions & 4 deletions charts/memgraph-high-availability/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ memgraph:
storagePVC: true
storagePVCSize: "1Gi"
logPVCClassName: ""
logPVC: false
logPVC: true
logPVCSize: "256Mi"
coordinators:
volumeClaim:
storagePVCClassName: ""
storagePVC: true
storagePVCSize: "1Gi"
logPVCClassName: ""
logPVC: false
logPVC: true
logPVCSize: "256Mi"


Expand All @@ -49,7 +49,7 @@ data:
- "--bolt-port=7687"
- "--also-log-to-stderr"
- "--log-level=TRACE"
- "--replication-restore-state-on-startup=true"
- "--log-file=/var/log/memgraph/memgraph.log"

- id: "1"
boltPort: 7687
Expand All @@ -61,39 +61,53 @@ data:
- "--bolt-port=7687"
- "--also-log-to-stderr"
- "--log-level=TRACE"
- "--replication-restore-state-on-startup=true"
- "--log-file=/var/log/memgraph/memgraph.log"

coordinators:
- id: "1"
boltPort: 7687
managementPort: 10000
coordinatorPort: 12000
args:
- "--experimental-enabled=high-availability"
- "--coordinator-id=1"
- "--coordinator-port=12000"
- "--management-port=10000"
- "--bolt-port=7687"
- "--also-log-to-stderr"
- "--log-level=TRACE"
- "--coordinator-hostname=memgraph-coordinator-1.default.svc.cluster.local"
- "--log-file=/var/log/memgraph/memgraph.log"
- "--nuraft-log-file=/var/log/memgraph/memgraph.log"

- id: "2"
boltPort: 7687
managementPort: 10000
coordinatorPort: 12000
args:
- "--experimental-enabled=high-availability"
- "--coordinator-id=2"
- "--coordinator-port=12000"
- "--management-port=10000"
- "--bolt-port=7687"
- "--also-log-to-stderr"
- "--log-level=TRACE"
- "--coordinator-hostname=memgraph-coordinator-2.default.svc.cluster.local"
- "--log-file=/var/log/memgraph/memgraph.log"
- "--nuraft-log-file=/var/log/memgraph/memgraph.log"

- id: "3"
boltPort: 7687
managementPort: 10000
coordinatorPort: 12000
args:
- "--experimental-enabled=high-availability"
- "--coordinator-id=3"
- "--coordinator-port=12000"
- "--management-port=10000"
- "--bolt-port=7687"
- "--also-log-to-stderr"
- "--log-level=TRACE"
- "--coordinator-hostname=memgraph-coordinator-3.default.svc.cluster.local"
- "--log-file=/var/log/memgraph/memgraph.log"
- "--nuraft-log-file=/var/log/memgraph/memgraph.log"

0 comments on commit 1617882

Please sign in to comment.