Ocelot being able to connect to a peered environment of multiple Eureka instances
Actual Behavior / Motivation for New Feature
Ocelot not able to connect and fail over between instances of Eureka
Steps to Reproduce the Problem
run multiple instances of Eureka in a peered mode, e.g.
peer 1: docker run --publish 8761:8761 -d steeltoeoss/eureka-server eureka.instance.name=peer1 --eureka.instance.preferIpAddress=true --eureka.client.serviceUrl.defaultZone=http://10.0.0.1:8761/eureka/,http://10.0.0.2:8761/eureka/
peer 2: docker run --publish 8761:8761 -d steeltoeoss/eureka-server eureka.instance.name=peer2 --eureka.instance.preferIpAddress=true --eureka.client.serviceUrl.defaultZone=http://10.0.0.1:8761/eureka/,http://10.0.0.2:8761/eureka/
confirm that the service discovery runs as a replication by looking at the Eureka dashboar at http://10.0.0.1:8761 and http://10.0.0.2:8761
setup Ocelot in the AspNetCore application as per the docs
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseUrls("http://localhost:8099")
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true,
true)
.AddJsonFile("ocelot.json", false, false)
.AddEnvironmentVariables();
})
.ConfigureServices(s =>
{
s.AddCors();
s
.AddOcelot()
.AddEureka()
// .AddCacheManager(x => x.WithDictionaryHandle())
;
s.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
})
.Configure(a =>
{
a.UseOcelot().Wait();
a.UseCors(b => b
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials()
);
})
.Build();
}
}
Expected Behavior / New Feature
Ocelot being able to connect to a peered environment of multiple Eureka instances
Actual Behavior / Motivation for New Feature
Ocelot not able to connect and fail over between instances of Eureka
Steps to Reproduce the Problem
docker run --publish 8761:8761 -d steeltoeoss/eureka-server eureka.instance.name=peer1 --eureka.instance.preferIpAddress=true --eureka.client.serviceUrl.defaultZone=http://10.0.0.1:8761/eureka/,http://10.0.0.2:8761/eureka/
peer 2:docker run --publish 8761:8761 -d steeltoeoss/eureka-server eureka.instance.name=peer2 --eureka.instance.preferIpAddress=true --eureka.client.serviceUrl.defaultZone=http://10.0.0.1:8761/eureka/,http://10.0.0.2:8761/eureka/
http://10.0.0.1:8761
andhttp://10.0.0.2:8761
setup Ocelot in the AspNetCore application as per the docs
ocelot.json
appsettings.json
Specifications