- PG Logical Replication: edgeguard_shared PUBLICATION auf Primary, edgeguard_sub SUBSCRIPTION auf Secondary. Nur geteilte Config-Tabellen werden repliziert; node-eigene Daten (network_interfaces, ip_addresses, static_routes, cluster_settings, dns_settings, ntp_settings) bleiben lokal — OPNsense-Muster. - cluster-init-replication: Erstellt PUBLICATION, Rolle + pg_hba-Einträge (logical + replication), WAL-Level auf logical. - cluster-setup-standby: Erstellt SUBSCRIPTION (copy_data=true), pollt pg_subscription_rel bis alle Tabellen sync = 'r', rendert dann Configs. - promote: manueller Failover via pg_promote() + touch recovery.signal. - VIP/Keepalived: cluster_settings-Tabelle (vip_address, vip_interface, vrrp_router_id), /cluster/vip-settings API, Keepalived-Config-Generator mit VRRP + check_script + notify-Skripten in /usr/lib/edgeguard/scripts/. - config_hash sync: Secondary pusht alle 5 Min seinen Hash via mTLS an Primary (PushSelfToPrimary). Heartbeat schreibt nur LOCAL, daher ohne aktiven Push wäre Primary-Sicht des Secondary-Hash stale gewesen. - runSecondaryConfigRender: Goroutine auf Secondary rendert HAProxy+nftables neu wenn config_hash sich ändert (Logical-Replication-Nachzügler). - confighash: node-spezifische Tabellen aus hashSpec entfernt. - postinst: Keepalived-Skripte installieren, sudoers für keepalived. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
1.6 KiB
Go
28 lines
1.6 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// HANode mirrort eine Row der ha_nodes-Tabelle. Erweitert in Migration
|
|
// 0020 um version/config_hash/mgmt_ip/status für Cluster-Phase-3-
|
|
// Drift-Detection + Health-State. Migration 0029 fügt PGRole hinzu.
|
|
type HANode struct {
|
|
ID string `gorm:"column:id;primaryKey" json:"id"`
|
|
Name string `gorm:"column:name" json:"name"`
|
|
FQDN string `gorm:"column:fqdn;uniqueIndex" json:"fqdn"`
|
|
APIURL string `gorm:"column:api_url" json:"api_url"`
|
|
PublicIP *string `gorm:"column:public_ip;type:inet" json:"public_ip,omitempty"`
|
|
InternalIP *string `gorm:"column:internal_ip;type:inet" json:"internal_ip,omitempty"`
|
|
MgmtIP *string `gorm:"column:mgmt_ip;type:inet" json:"mgmt_ip,omitempty"`
|
|
Role string `gorm:"column:role" json:"role"`
|
|
PGRole string `gorm:"column:pg_role" json:"pg_role"`
|
|
Version *string `gorm:"column:version" json:"version,omitempty"`
|
|
ConfigHash *string `gorm:"column:config_hash" json:"config_hash,omitempty"`
|
|
Status string `gorm:"column:status" json:"status"`
|
|
LastSeen *time.Time `gorm:"column:last_seen" json:"last_seen,omitempty"`
|
|
JoinedAt time.Time `gorm:"column:joined_at" json:"joined_at"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
|
}
|
|
|
|
func (HANode) TableName() string { return "ha_nodes" }
|