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

Add repmgr extension #424

Closed
wants to merge 15 commits into from
Closed

Conversation

rbjorklin
Copy link

This PR adds opt-in functionality for Postgres replication controlled by repmgr.

@nchudleigh
Copy link
Contributor

The code looks solid!

I wonder with how much PostgreSQL is investing in replication if this is going to be something that people will need long term.

Would make more sense to me as its own role that users can install and use alongside this one.

@gclough gclough self-requested a review May 17, 2019 09:29
Copy link
Collaborator

@gclough gclough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the automated Travis tests be updated to install/test this?

templates/repmgr.conf.j2 Outdated Show resolved Hide resolved
@rbjorklin
Copy link
Author

Just wanted to chime in and say that I haven't abandoned this. I just can't find time to fix this at the moment.

@rbjorklin
Copy link
Author

rbjorklin commented Dec 13, 2019

@gclough I've added an installation test and as there is a step in the extension to verify cluster functionality I feel pretty okay with this now. I will say though that I'm not at all familiar with Travis and it feels like I have shoe-horned a test into the existing suite so if someone could provide some pointers on that it would be appreciated.

@egmont1227
Copy link
Contributor

@robustq
Copy link

robustq commented Feb 22, 2021

@egmont1227 and @rbjorklin - thank you much for your work on this. One thing that bit me on @egmont1227 's branch was that in defaults/repmgr.yml, the conninfo doesn't set the passfile={{repmgr_passfile}}.

@robustq
Copy link

robustq commented Feb 22, 2021

Hey all, another issue to note that should be a quick fix:

https://github.com/noris-network/ansible-postgresql/blob/add-repmgr-extension/tasks/extensions/configure_repmgr.yml#L100 assumes repmgr is the repmgr user, and should be configurable

- name: Repmgr | Clone standby
  command: "{{postgresql_bin_directory}}/repmgr -F -h {% for host, vars in hostvars.items() if 'repmgr_primary' in vars and vars['repmgr_primary'] == True %}{{ host }}{% endfor %} -p {{ postgresql_port }} -U repmgr -d repmgr -f {{repmgr_config_directory}}/repmgr.conf standby clone"
  become: yes
  become_user: "{{ postgresql_service_user }}"
  when: not repmgr_primary and not ansible_hostname in  repmgr_cluster_show.stdout and not "standby" in repmgr_cluster_show.stdout

@robustq
Copy link

robustq commented Feb 22, 2021

@egmont1227 and @rbjorklin I was able to get this working on Ubuntu 18.04, and ran into a few other issues - will document the changes I made - some were done the 'right' way, others were a bit hackish just to get what I needed working. Either way, your work on this was super helpful, and I appreciate you making this available!!!

@egmont1227
Copy link
Contributor

egmont1227 commented Feb 24, 2021

True, we also jumped upon it and got it working some time ago.

Thank you for your review on noris network branch. Will look into it.

@egmont1227 and @rbjorklin - thank you much for your work on this. One thing that bit me on @egmont1227 's branch was that in defaults/repmgr.yml, the conninfo doesn't set the passfile={{repmgr_passfile}}.

This is done differently. See https://github.com/2ndQuadrant/repmgr/blob/dd8204e01354ce75a6fa49eefc804fe5d24e8e56/repmgr.conf.sample#L167 for the example config-snippet and e.g. https://github.com/noris-network/ansible-postgresql/blob/0c15305a9e67529b992c0ec9df57fdda424fff9b/templates/repmgr.conf-5.0.j2#L168 defining the variable

Hey all, another issue to note that should be a quick fix:

https://github.com/noris-network/ansible-postgresql/blob/add-repmgr-extension/tasks/extensions/configure_repmgr.yml#L100 assumes repmgr is the repmgr user, and should be configurable

You are right. Have to investigate either use repmgr_user or repmgr_replication_user, but guess it will be rempgr_user

@egmont1227 egmont1227 mentioned this pull request Feb 24, 2021
@robustq
Copy link

robustq commented Feb 25, 2021

@egmont1227 I did end up adding in quite a few workarounds, many are hacks that I'd like to figure out (Debian-specific changes, for systemd, etc.) but if you want to glance over it nonetheless, check out the changes at https://github.com/robustq/postgresql/commits/master

@jhg03a
Copy link

jhg03a commented May 27, 2021

I'm in the process of doing similar work, but would love if one of the PRs were merge ready. Postgresql doesn't appear to have an interest in trying to do the featureset of repmgr sofar. Being able to construct automatic HA failovers is a huge gain.

Copy link

This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

@github-actions github-actions bot added the stale label Feb 21, 2024
@rbjorklin
Copy link
Author

I no longer care about this. Anyone who wants to; feel free to adopt and use this as you please.

@rbjorklin rbjorklin closed this Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants