loki 分布式日志系统错误排查

在配置文件配置redis后,报如下错误

msg="failed to put to redis" name=store.index-cache-write.redis err="EXECABORT Transaction discarded because of previous errors."

原因:redis多个地址用逗号分割,如果只配置一个地址,而我们的redis又是cluster模式的话,会报改错
解决办法:如果是集群版redis,写多个redis地址即可

// NewUniversalClient returns a new multi client. The type of the returned client depends
// on the following conditions:
//
// 1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned.
// 2. if the number of Addrs is two or more, a ClusterClient is returned.
// 3. Otherwise, a single-node Client is returned.
func NewUniversalClient(opts *UniversalOptions) UniversalClient {
    if opts.MasterName != "" {
        return NewFailoverClient(opts.Failover())
    } else if len(opts.Addrs) > 1 {
        return NewClusterClient(opts.Cluster())
    }
    return NewClient(opts.Simple())
}

你可能感兴趣的:(loki 分布式日志系统错误排查)