Automatic failover of Moodle database in PostgreSQL using ClusterControl


β€” . , . , -, , , , β€” . .





, , , failover, (promote) . failover Moodle PostgreSQL ClusterControl.





failover 





  • uptime





  • DBA ,





 

Postgres β€” HAProxy, Moodle PostgreSQL. failover ClusterControl (cluster recovery) (node auto recovery).





ClusterControl , failover.





cmon :





  1. replication_failover_whitelist



    β€” IP- , . , .





  2. replication_failover_blacklist



    β€” , . , . , .





(auto failover)

1





(192.168.33.14) sysbench.





[root@centos11 sysbench]# /bin/sysbench --db-driver=pgsql --oltp-table-size=100000 --oltp-tables-count=24 --threads=2 --pgsql-host=****** --pgsql-port=6543 --pgsql-user=sbtest --pgsql-password=***** --pgsql-db=sbtest /usr/share/sysbench/tests/include/oltp_legacy/parallel_prepare.lua run
 
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
 
 
 
Running the test with following options:
 
Number of threads: 2
 
Initializing random number generator from current time
 
 
 
 
Initializing worker threads...
 
 
 
Threads started!
 
 
 
thread prepare0
 
Creating table 'sbtest1'...
 
Inserting 100000 records into 'sbtest1'
 
Creating secondary indexes on 'sbtest1'...
 
Creating table 'sbtest2'...
      
      



2





Postgres (192.168.33.14). ClusterControl enable_cluster_autorecovery, .





# service postgresql-12 stop
      
      



3





ClusterControl . , .





192.168.33.13 , . HAProxy Moodle . 





192.168.33.13





postgres=# select pg_is_in_recovery();
 
 pg_is_in_recovery 
 
-------------------
 
 f
 
(1 row)
      
      



192.168.33.15





postgres=# select pg_is_in_recovery();
 
 pg_is_in_recovery 
 
-------------------
 
 t
 
(1 row)
      
      



HAProxy . , ClusterControl.





ClusterControl , HAProxy , .





, . ClusterControl. , , .





ClusterControl .





failover β€” Moodle. , . , failover .






"PostgreSQL".





- Β« Β». :

β€” ;

β€” , ;

β€” ;

β€” , .












All Articles