Files
juipnet/Infrastructure/log_storage/redis/redispull.go
“wanyongkang” ed3b2c653e 接口文件
2024-04-10 13:55:27 +08:00

33 lines
439 B
Go

package redis
import (
"fmt"
"github.com/go-redis/redis"
"time"
)
func RedisPullStart(parse chan<- *string, client *redis.Client) {
pong, err := client.Ping().Result()
if err != nil {
panic("redis连接失败")
}
fmt.Println(pong, err)
for {
vals, err := client.BLPop(0, "filebeat").Result()
if err != nil {
fmt.Println(err)
time.Sleep(time.Second * 10)
}
if len(vals) == 2 {
parse <- &vals[1]
}
}
}