mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-31 05:07:01 +00:00
fix: use actual bind IP for service health checks
- Previously health checks were hardcoded to localhost (127.0.0.1) - This caused failures when services bind to actual IP (e.g., 10.21.153.8) - Now health checks use the same IP that services are binding to - Fixes Volume and other service health check failures on non-localhost IPs
This commit is contained in:
+13
-7
@@ -767,13 +767,19 @@ func runMini(cmd *Command, args []string) bool {
|
||||
|
||||
// startMiniServices starts all mini services with proper dependency coordination
|
||||
func startMiniServices(miniWhiteList []string, allServicesReady chan struct{}) {
|
||||
// Determine bind IP for health checks
|
||||
bindIp := *miniIp
|
||||
if *miniBindIp != "" {
|
||||
bindIp = *miniBindIp
|
||||
}
|
||||
|
||||
// Start Master server (no dependencies)
|
||||
go startMiniService("Master", func() {
|
||||
startMaster(miniMasterOptions, miniWhiteList)
|
||||
}, *miniMasterOptions.port)
|
||||
|
||||
// Wait for master to be ready
|
||||
waitForServiceReady("Master", *miniMasterOptions.port)
|
||||
waitForServiceReady("Master", *miniMasterOptions.port, bindIp)
|
||||
|
||||
// Start Volume server (depends on master)
|
||||
go startMiniService("Volume", func() {
|
||||
@@ -782,7 +788,7 @@ func startMiniServices(miniWhiteList []string, allServicesReady chan struct{}) {
|
||||
}, *miniOptions.v.port)
|
||||
|
||||
// Wait for volume to be ready
|
||||
waitForServiceReady("Volume", *miniOptions.v.port)
|
||||
waitForServiceReady("Volume", *miniOptions.v.port, bindIp)
|
||||
|
||||
// Start Filer (depends on master and volume)
|
||||
go startMiniService("Filer", func() {
|
||||
@@ -790,7 +796,7 @@ func startMiniServices(miniWhiteList []string, allServicesReady chan struct{}) {
|
||||
}, *miniFilerOptions.port)
|
||||
|
||||
// Wait for filer to be ready
|
||||
waitForServiceReady("Filer", *miniFilerOptions.port)
|
||||
waitForServiceReady("Filer", *miniFilerOptions.port, bindIp)
|
||||
|
||||
// Start S3 and WebDAV in parallel (both depend on filer)
|
||||
go startMiniService("S3", func() {
|
||||
@@ -802,8 +808,8 @@ func startMiniServices(miniWhiteList []string, allServicesReady chan struct{}) {
|
||||
}, *miniWebDavOptions.port)
|
||||
|
||||
// Wait for both S3 and WebDAV to be ready
|
||||
waitForServiceReady("S3", *miniS3Options.port)
|
||||
waitForServiceReady("WebDAV", *miniWebDavOptions.port)
|
||||
waitForServiceReady("S3", *miniS3Options.port, bindIp)
|
||||
waitForServiceReady("WebDAV", *miniWebDavOptions.port, bindIp)
|
||||
|
||||
// Start Admin with worker (depends on master, filer, S3, WebDAV)
|
||||
go startMiniAdminWithWorker(allServicesReady)
|
||||
@@ -816,8 +822,8 @@ func startMiniService(name string, fn func(), port int) {
|
||||
}
|
||||
|
||||
// waitForServiceReady pings the service HTTP endpoint to check if it's ready to accept connections
|
||||
func waitForServiceReady(name string, port int) {
|
||||
address := fmt.Sprintf("http://127.0.0.1:%d", port)
|
||||
func waitForServiceReady(name string, port int, bindIp string) {
|
||||
address := fmt.Sprintf("http://%s:%d", bindIp, port)
|
||||
maxAttempts := 30 // 30 * 200ms = 6 seconds max wait
|
||||
attempt := 0
|
||||
client := &http.Client{
|
||||
|
||||
Reference in New Issue
Block a user