Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update entrypoint-sentinel.sh #73

Merged
merged 1 commit into from
Sep 19, 2024
Merged

Conversation

iva3682
Copy link
Contributor

@iva3682 iva3682 commented Feb 26, 2024

add SENTINEL_ID for fixed sentinel myid

@drivebyer
Copy link
Collaborator

Why do we need custom this param ? @iva3682

@iva3682
Copy link
Contributor Author

iva3682 commented Sep 18, 2024

When you restart a pod with Sentinel, its myid changes to a random one. Other Sentinels receive his new myid, but the old one also takes part in the elections, which prevents the correct determination of the Sentinel master. Using the SENTINEL_ID parameter, you can fix myid to a specific value.
For example, (when using Stateful Sets) like this:

...
- env:
  - name: SENTINEL_ID
    valueFrom:
      fieldRef:
	apiVersion: v1
	fieldPath: metadata.name
...

@drivebyer
Copy link
Collaborator

I understand. It seems to be related to removing the sentinel in the cluster, as described in this Redis documentation. I'm not sure if it works, because I couldn't find an example of sentinel myid in the Redis GitHub repository.

@iva3682
Copy link
Contributor Author

iva3682 commented Sep 19, 2024

Yes, for some reason Redis developers do not mention the possible "sentinel myid" configuration in sentinel.conf (it might make sense to create a corresponding issue in the redis repository), but this parameter is described here: https://github.com/redis/redis/blob/617909e943be0691ac9179aa1e6664937a4ca255/src/sentinel.c#L510. I use this patch in my cluster and it works fine: after restarting the Sentinel pod, the expected number of instances participate in the elections, not +1. There is no need to execute the SENTINEL RESET command after restarting the pod, this has a good effect on the autonomy of the Sentinel cluster.

@drivebyer
Copy link
Collaborator

@iva3682 iva3682 force-pushed the master branch 3 times, most recently from a43804f to 2f28295 Compare September 19, 2024 08:17
@drivebyer drivebyer merged commit 9d6d186 into OT-CONTAINER-KIT:master Sep 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants