Search code examples
pythonpercona

Find the nodes in the percona cluster


How do I find the number of nodes and node ip addresses in the Percona XtraDB cluster from inside a Python application? I know the IP address of one node in the cluster.


Solution

  • This can be done by executing

    show variables like 'wsrep_cluster_address';

    For example using sqlalchemy, you can do this by:

    engine.execute("SHOW VARIABLES LIKE 'wsrep_cluster_address'").fetchone()