Skip to content

francistm/grpc-redis-client-lb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GRPC Redis Client LoadBalancer

Redis connection

There's no restriction for redis package.

You can create a struct which wrap the redis package you're using, and implement the resolver.Redis interface.

Discovery

// create an redis connection which implements the resolver.Redis interface
var redisConn resolver.Redis

// registe schema
discovery.RegisterSchema(redisConn)

// discovery and dial the server
conn, err := grpc.Dial("redis://service-foo", grpc.WithInsecure())

Registry

// create an redis connection which implements the resolver.Redis interface
var redisConn resolver.Redis

ctx := context.Background()
_, err := registry.RegisterService(ctx, redisConn, "service-foo", 8080, registry.WithStaticProvider("127.0.0.1"))

Listening addr providers

Static IP

The option registry.WithStaticProvider("127.0.0.1") is used to register the service with a known IP.

AWS ECS

The option registry.WithECSProvider() is used to register the service which is running in aws ECS. It will detect container IP through ECS metadata automatically.

About

Golang grpc redis based client load balance

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages