patroni | A template for PostgreSQL High Availability with Etcd | Key Value Database library

 by   zalando Python Version: 3.3.0 License: MIT

kandi X-RAY | patroni Summary

kandi X-RAY | patroni Summary

patroni is a Python library typically used in Database, Key Value Database applications. patroni has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install patroni' or download it from GitHub, PyPI.

A template for PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              patroni has a highly active ecosystem.
              It has 5482 star(s) with 723 fork(s). There are 129 watchers for this library.
              There were 3 major release(s) in the last 6 months.
              There are 47 open issues and 1532 have been closed. On average issues are closed in 20 days. There are 24 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of patroni is 3.3.0

            kandi-Quality Quality

              patroni has 0 bugs and 0 code smells.

            kandi-Security Security

              patroni has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              patroni code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              patroni is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              patroni releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              patroni saves you 8898 person hours of effort in developing the same functionality from scratch.
              It has 19597 lines of code, 1992 functions and 87 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed patroni and discovered the below as its top functions. This is intended to give you an instant insight into patroni implemented functionality, and help decide if they suit your requirements.
            • Run periodic cycle .
            • Build the environment configuration .
            • Check if wal - e is used to create a replicas .
            • Execute a failover or switch over master .
            • Return the metrics for the patroni
            • Creates a replica in the replication process .
            • Get an eCD client .
            • Start the PostgreSQL server .
            • Check if we have a recovery configuration .
            • Returns a list of slots that are assigned to this leader .
            Get all kandi verified functions for this library.

            patroni Key Features

            No Key Features are available at this moment for patroni.

            patroni Examples and Code Snippets

            copy iconCopy
            ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"
            ssh-copy-id root@server_ip_address
            
            sudo systemctl daemon-reload
            sudo systemctl start patroni.service
            sudo systemctl enable patroni.service
            
            [root@pg-patroni1 vagrant]# sudo patronictl -c /opt/app/  
            Pigsty - PostgreSQL Deploy Template,Architecture
            Shelldot img2Lines of Code : 19dot img2no licencesLicense : No License
            copy iconCopy
            # connect to primary
            psql postgres://dbuser_test:dbuser_test@primary.testdb.service.consul:5432/testdb
            
            # conntect to standby (random choose one)
            psql postgres://dbuser_test:dbuser_test@standby.testdb.service.consul:5432/testdb
            
            # haproxy primary ser  
            Docker images for Postgres
            Shelldot img3Lines of Code : 15dot img3no licencesLicense : No License
            copy iconCopy
            debian:buster-slim
                  |
                  v
            python:3.8-slim-buster
                  |
                  v
            perrygeo/gdal-base:latest
                  |
                  V
            perrygeo/postgres:latest
            
            POSTGRES_VERSION 12.2
            PROTOBUF_VERSION 3.6.1
            PROTOBUF_C_VERSION 1.3.1
            POSTGIS_VERSION 3.1.0alpha
            # TIMESCALE  

            Community Discussions

            QUESTION

            How to cancel a broken StatefulSets rolling update?
            Asked 2021-Dec-14 at 13:42

            I have a PostgreSQL Kubernetes Service based on Patroni/Spilo. This Kubernetes service deploys a cluster of three PostgreSQL pods + three Etcd pods. During maintenance, I had a failure and I wasn't able to restore the old configuration that worked fine before the rolling update.

            I searched for documentation and it seems StatefulSets doesn't support rollbacks as deployment. I found this thread that references this doc.

            To be honest, however, I didn't understand how to proceed.

            My cluster has the following pods:

            ...

            ANSWER

            Answered 2021-Dec-14 at 13:42

            To undo changes that have been made, first checkout the rollout history kubectl rollout history sts -n .

            Get more details about a revision kubectl rollout history sts --revision -n .

            Undo the changes kubectl rollout undo sts --to-revision -n

            Source https://stackoverflow.com/questions/70346644

            QUESTION

            Kustomize nameSuffix skip on some resources
            Asked 2021-Nov-10 at 09:52

            I am using Kustomize to manage multiple variations of the same cluster. I am using nameSuffix option to add a suffix to all my resources:

            ...

            ANSWER

            Answered 2021-Nov-09 at 13:12

            Skipping selected kinds doesn't work because this feature wasn't implemented - from this comment on GitHub issue 519.

            Also this is an example how it was supposed to be (what you tried)

            Based on this comment, it works on kinds that were explicitly mentioned:

            The plugin's config is currently oriented towards specifying which kinds to modify, ignoring others.

            Also based on some tests I performed, it looks for kinds only, it doesn't look for names or anything, so only the whole kind can be included. Hence second part of your question is I'm afraid not possible (well, using kustomize, you can use sed for instance and modify everything you need on the go).

            I created a simple structure and tested it:

            Source https://stackoverflow.com/questions/69882949

            QUESTION

            Import json array of objects using react hooks
            Asked 2021-Nov-03 at 10:12

            I was searching an entire day to add some categories from a JSON file using React hooks, with no luck so far. I am hoping that anyone can help me with this. Here is how the JSON it looks:

            ...

            ANSWER

            Answered 2021-Nov-03 at 10:12

            It looks like you don't need a state. You could move categories out your component (because json is not going to change and doesn't depend on anything) and just use this variable to iterate by.

            Source https://stackoverflow.com/questions/69822997

            QUESTION

            Pod name resolution for StatefulSet doesn't work
            Asked 2021-Oct-27 at 11:14

            I have the following Kubernetes YAML with a StatefulSet I use to deploy a PostgreSQL cluster with Patroni. However, the question is relative to how Kubernetes registers Pod names in CoreDNS.

            According to this documentation in the Stable Network ID section if I create a Headless service called spilodemo-svc for my Pods I can access them using the short hostname (podname.servicename):

            ...

            ANSWER

            Answered 2021-Oct-27 at 11:14

            After almost three days of tests, I found a solution. The solution depends on two things:

            1. how Kubernetes works;
            2. how Patroni works.

            How Kubernetes Works

            When you create a StatefulSet deployment (but this is true also for Deployment), let's say with 3 pods, Kubernetes register in CoreDNS three DNS names:

            Source https://stackoverflow.com/questions/69577282

            QUESTION

            How to setup Kubernetes CPU and Memory for PostgreSQL
            Asked 2021-Jun-28 at 22:53

            I have a PostgreSQL cluster with three nodes with Patroni. The cluster manages a very high workload and for this reason, it runs in production on bare metal machines. We need to migrate this infrastructure to Kubernetes (for several reasons) and I am doing some performance tests executed with PgBench. First I compared Baremetal vs Virtual Machine and I got very small degradation. Then I compared VSI vs Kubernetes to understand the overhead added by K8s.

            Now I am trying to fine-tune CPU and memory. K8s runs on Worker nodes with 48 vCPU and 192 Gb. However, once PostgreSQL was deployed I still see:

            ...

            ANSWER

            Answered 2021-Jun-28 at 22:53

            this is a great question and it also took me some time earlier this year to find out by experience.

            It is important to understand that request have no actual effect on the resource usage of containers. You can check by connecting to your Server and running htop or kubectl top like you did, and you see that even though you defined requests: memory: 64Gi only 244Mi are used.

            The main purpose of requests is to influence scheduling behavior. When the Kubernetes Scheduler looks for a fitting Node to place a new Pod on it, it checks for the currently requested CPU and Memory of the Nodes. You can check current status of nodes yourself by running the following command.

            Source https://stackoverflow.com/questions/68166145

            QUESTION

            How to configure HaProxy to balance read requests to all nodes of a PostgreSQL cluster?
            Asked 2021-May-19 at 18:38

            I have a PostgreSQL cluster on Patroni (Haproxy+Keepalived+etcd) - one primary node and two standby nodes.

            For now, Haproxy is configured in this way:

            • port 5000 to connect to the primary node
            • port 5001 to connect to the standby nodes

            How can I configure Haproxy so that the port 5001 is used to connect to the standby nodes as well as the primary node?

            This is my haproxy.cfg below:

            ...

            ANSWER

            Answered 2021-May-19 at 18:38

            In a patroni documentation I found the /health endpoint patroni rest-api:

            returns HTTP status code 200 only when PostgreSQL is up and running.

            I tried to use that endpoint in haproxy configuration, and it works like expected, patroni give all 3 nodes when all nodes alive, and don't give nodes that aren't in running state

            So, if you want to add all nodes to haproxy balance, create a new backend in haproxy.conf

            Source https://stackoverflow.com/questions/67209042

            QUESTION

            Postgres 13 and Failover Slots
            Asked 2021-Apr-08 at 12:20

            I have Postgres HA solution using streaming replication and managed by Patroni. I would like to also add logical replication. In case of a failover from master to the slave, do I need to rebuild the logical replication from scratch, or the Failover Slots solution discussed by Craig Ringer was implemented in Postgres 13.

            ...

            ANSWER

            Answered 2021-Apr-08 at 12:20

            Replication slots only exist on the primary, and there is no high availability solution for them. You will have to rebuild the logical standby after a failover.

            Source https://stackoverflow.com/questions/67003379

            QUESTION

            Replica node never recover after rewind in Zalando operator
            Asked 2021-Mar-15 at 22:53

            I making a POC, in my test I killed the primary node, other node take the primary role, the new replica rewind.... but dead whit this messages:

            ...

            ANSWER

            Answered 2021-Mar-15 at 22:53

            After go inside the docker, exec a patronictl -c ... reinit, wait and your node will be online again....❗

            Source https://stackoverflow.com/questions/66642931

            QUESTION

            Postgres keeps rejecting Patroni connection attempts
            Asked 2020-Oct-08 at 06:22

            I am trying to set up Patroni (2.0.1) for the first time with PG12.

            Even though the authentication users specified in the config exist in PG (with correct passwords), PG keeps on rejecting the connection.

            This is my config -

            ...

            ANSWER

            Answered 2020-Oct-08 at 02:33

            I'd say that your pg_hba.conf is too restrictive. Use something like

            Source https://stackoverflow.com/questions/64251800

            QUESTION

            Error installing TimescaleDB with K8S / Helm : MountVolume.SetUp failed for volume "certificate" : secret "timescaledb-certificate" not found
            Asked 2020-Aug-10 at 08:54

            I just tried to install timescaleDB Single with Helm in minikube on Ubuntu 20.04.

            After installing via:

            helm install timescaledb timescaledb/timescaledb-single --namespace espace-client-v2

            I got the message:

            ...

            ANSWER

            Answered 2020-Aug-10 at 08:54

            I could do it. If the page https://github.com/timescale/timescaledb-kubernetes doesn't give much details about installation process, you can go here:

            https://github.com/timescale/timescaledb-kubernetes/tree/master/charts/timescaledb-single

            I had to use kustomize to generate content:

            Source https://stackoverflow.com/questions/63304715

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install patroni

            You can install using 'pip install patroni' or download it from GitHub, PyPI.
            You can use patroni like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install patroni

          • CLONE
          • HTTPS

            https://github.com/zalando/patroni.git

          • CLI

            gh repo clone zalando/patroni

          • sshUrl

            git@github.com:zalando/patroni.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link