feat(cluster): add voicemail & fail2ban sync and automatic failback re-sync reconciliation
This commit is contained in:
1 parent
54fc495fa7
commit
d1d42f75b5
5 files changed
+270
-1
No files matched your search
@@ -10,7 +10,14 @@ TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
echo "[$TIMESTAMP] [CLUSTER] >>> Transition vers l'état MASTER (VIP active) <<<" >> "$LOG_FILE"
|
||||
|
||||
# 0. Ouverture immédiate des ports SIP entrants sur le nouveau MASTER (levée d'isolation)
|
||||
# 0. Réconciliation préalable au Failback : si le pair était actif et a des modifications plus récentes,
|
||||
# récupérer sa réplication AVANT d'ouvrir les flux SIP et de servir le trafic !
|
||||
if [ -f "/var/www/nexus-pbx/scripts/nexus_cluster_sync.php" ]; then
|
||||
echo "[$TIMESTAMP] [CLUSTER] Vérification réconciliation failback avec le pair..." >> "$LOG_FILE"
|
||||
php /var/www/nexus-pbx/scripts/nexus_cluster_sync.php --failback-check >> "$LOG_FILE" 2>&1 || true
|
||||
fi
|
||||
|
||||
# 1. Ouverture immédiate des ports SIP entrants sur le nouveau MASTER (levée d'isolation)
|
||||
iptables -D INPUT -p udp -m multiport --dports 5060,5061 -j REJECT --reject-with icmp-port-unreachable 2>/dev/null || true
|
||||
iptables -D INPUT -p tcp -m multiport --dports 5060,5061 -j REJECT --reject-with tcp-reset 2>/dev/null || true
|
||||
|
||||
|
||||
@@ -14,6 +14,15 @@ use App\Database;
|
||||
use App\ClusterManager;
|
||||
|
||||
try {
|
||||
// Mode réconciliation immédiate au Failback (appelé par notify_master.sh)
|
||||
if (in_array('--failback-check', $argv ?? [], true)) {
|
||||
$db = Database::getConnection();
|
||||
$cm = new ClusterManager($db);
|
||||
$res = $cm->failbackReconcileWithPeer();
|
||||
echo date('[Y-m-d H:i:s] ') . "[CLUSTER-FAILBACK] " . ($res['message'] ?? 'OK') . "\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// 0. Verrou d'exécution exclusif pour éviter les chevauchements
|
||||
$lockFp = @fopen('/tmp/nexus_cluster_cron.lock', 'c+');
|
||||
if (!$lockFp || !@flock($lockFp, LOCK_EX | LOCK_NB)) {
|
||||
|
||||
Reference in new issue
Block a user