Files
juipnet/Infrastructure/log_storage/redis/redispull.go
wanyongkang d318014316 初始提交
2020-10-07 20:25:03 +08:00

33 lines
471 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]
}
}
}