更新es报错降级为警告
This commit is contained in:
@@ -45,9 +45,11 @@ func Init(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 测试连接
|
// 测试连接
|
||||||
info, code, err := client.Ping(addresses[0]).Do(ctx)
|
info, code, testErr := client.Ping(addresses[0]).Do(ctx)
|
||||||
if err != nil {
|
if testErr != nil {
|
||||||
glog.Errorf(ctx, "ES 连接测试失败: %v", err)
|
glog.Warningf(ctx, "ES 连接测试失败(月度归档功能不可用): %v", testErr)
|
||||||
|
client = nil // 清空客户端
|
||||||
|
err = testErr
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
glog.Infof(ctx, "ES 连接成功 - 版本: %s, 状态码: %d", info.Version.Number, code)
|
glog.Infof(ctx, "ES 连接成功 - 版本: %s, 状态码: %d", info.Version.Number, code)
|
||||||
|
|||||||
Reference in New Issue
Block a user