# Redis connectivity probe (no secrets printed) $ErrorActionPreference = 'Continue' Get-Content 'E:\wwwroot\.env' | ForEach-Object { $line = $_.Trim() if (-not $line -or $line.StartsWith('#')) { return } $i = $line.IndexOf('=') if ($i -lt 1) { return } $k = $line.Substring(0, $i).Trim() $v = $line.Substring($i + 1).Trim().Trim('"') if ($k -match 'REDIS|YTD_REDIS') { if ($k -match 'PASSWORD|URL') { Write-Output ("$k len=" + $v.Length + " has_at=" + ($v -match '@')) } else { Write-Output ("$k=$v") } } } Write-Output '=== local 6379 ===' $c = Get-NetTCPConnection -LocalPort 6379 -State Listen -EA SilentlyContinue | Select-Object -First 1 if ($c) { "127.0.0.1:6379 LISTEN pid=$($c.OwningProcess)" } else { 'local 6379 down' } $redisCli = @( 'C:\yutongda\tools\Redis\redis-cli.exe', 'C:\Program Files\Redis\redis-cli.exe', 'E:\wwwroot\tools\redis-cli.exe' ) | Where-Object { Test-Path $_ } | Select-Object -First 1 Write-Output ("redis-cli=" + $redisCli) # try ping local without auth if ($redisCli) { & $redisCli -h 127.0.0.1 -p 6379 PING 2>&1 | ForEach-Object { "local_nopass: $_" } } # try data host from env if present $hostLine = (Get-Content 'E:\wwwroot\.env' | Where-Object { $_ -match '^YTD_REDIS_HOST=' } | Select-Object -First 1) if ($hostLine) { $rh = $hostLine.Split('=',2)[1].Trim().Trim('"') Write-Output ("env_host=$rh") if ($redisCli -and $rh -and $rh -ne '127.0.0.1') { & $redisCli -h $rh -p 6379 PING 2>&1 | ForEach-Object { "remote_nopass: $_" } } } Write-Output 'REDIS_PROBE_DONE'