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

Support Consul for distributed consensus #85

Closed
RashadAnsari opened this issue Jan 4, 2021 · 8 comments
Closed

Support Consul for distributed consensus #85

RashadAnsari opened this issue Jan 4, 2021 · 8 comments
Assignees
Labels
enhancement Improvement of the current functionality

Comments

@RashadAnsari
Copy link

Can you please support Consul as a distributed consensus store?

@vitabaks vitabaks self-assigned this Jan 4, 2021
@vitabaks vitabaks added the enhancement Improvement of the current functionality label Jan 4, 2021
@asobeeh
Copy link

asobeeh commented Mar 21, 2021

any update about supporting consul please

@vitabaks
Copy link
Owner

vitabaks commented Mar 23, 2021

I do not plan to implement and maintain code to deploy the Consul cluster, instead we can use this playbook https://github.com/ansible-community/ansible-consul
I will add variables to configure interaction with the Consul.
In addition, we need to configure the connection with Consul and test the operation of these components: confd for the [Type A] schema, vip-manager for the [Type B] schema (if variable cluster_vip is specified).

I'll do it right away as soon as I can allocate more time.
I appreciate any help.

@vitabaks vitabaks changed the title Support Consol for distributed consensus Support Consul for distributed consensus Mar 23, 2021
@asobeeh
Copy link

asobeeh commented Mar 23, 2021

Thanks For your update,
and for your info i installed consul cluster manually and changed that in patroni.yml file the part of etcd: hosts with consul and changed with consul ports
and restarted patroni and worked with no issues.
as I faced an issues with etcd and could not solve it so I changed to consul

@vitabaks
Copy link
Owner

as I faced an issues with etcd and could not solve it so I changed to consul

etcd is very reliable, usually there are no problems with it. If you encountered a problem, do not hesitate to open a new issue.

@vitabaks
Copy link
Owner

vitabaks commented Dec 28, 2022

I’m studying the work of Consul Service Discovery with DNS resolving and I’m starting to like it.

It is convenient to search for the master and replicas (without using vip-manager or haproxy) example: master.patroni.service.consul and replica.patroni.service.consul as a client access point. But it requires the installation of a consul in client mode on each application server for service DNS resolution (or check forward DNS to the remote consul server instead of installing a local consul client).
Nevertheless, it can be useful for a distributed cluster across different data centers. We can specify in advance which data center the database server is located in and then use this for applications running in the same data center.
Example:

  • replica.patroni.service.dc1.consul
  • replica.patroni.service.dc2.consul

And, we can add any custom checks so that the service is considered healthy and the DNS record for this service is active.

I'm thinking of adding a new type of schema: "[Type C] PostgreSQL High-Availability with Consul Service Discovery (DNS)" based on "Patroni" and "Consul".

I'm thinking of doing it!

@vitabaks vitabaks changed the title Support Consul for distributed consensus TODO: Support Consul for distributed consensus Jan 2, 2023
@vitabaks
Copy link
Owner

vitabaks commented Jan 4, 2023

@RashadAnsari @gc-ss

PR: #238

To test, follow these steps:

# 1. clone this repository from branch "consul"
git clone --branch consul --single-branch https://github.com/vitabaks/postgresql_cluster.git

# 2. Go to the playbook directory
cd postgresql_cluster/

# 3. Edit the inventory file
vim inventory
## Specify (non-public) IP addresses and connection settings (`ansible_user`, `ansible_ssh_pass` or `ansible_ssh_private_key_file` for your environment

# 4. Edit the variable file vars/main.yml
vim vars/main.yml
## Specify the variable: "dcs_type: consul"

# 5. install consul role requirements on the control node
ansible-galaxy install -r roles/consul/requirements.yml

# 6. Run playbook:
ansible-playbook deploy_pgcluster.yml

Client access point:

  • master.postgres-cluster.service.consul
  • replica.postgres-cluster.service.consul

@vitabaks
Copy link
Owner

vitabaks commented Jan 4, 2023

cc @askurihin

@vitabaks vitabaks changed the title TODO: Support Consul for distributed consensus Support Consul for distributed consensus Jan 17, 2023
@vitabaks
Copy link
Owner

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of the current functionality
Projects
None yet
Development

No branches or pull requests

3 participants