Issue with using with Docker
Closed this issue · 6 comments
Using MongoDB provider with MongoDB deployed in docker container.
I can connect to MongoDB using MongoClient, but can't use MongoDB provider. In logs i see bunch of errors:
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in System.Net.Sockets.dll
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in MongoDB.Driver.Core.dll
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in MongoDB.Driver.Core.dll
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in System.Private.CoreLib.dll
Exception thrown: 'MongoDB.Driver.MongoConnectionException' in MongoDB.Driver.Core.dll
Exception thrown: 'MongoDB.Driver.MongoConnectionException' in System.Private.CoreLib.dll
Using .Net Core 2.0, Orleans.Providers.MongoDB ver 2.0.0-preview2, MongoDB.Driver 2.5.0
Configuration:
var storage = await Dns.GetHostAddressesAsync("mongoStorage").ConfigureAwait(false);
var membership = await Dns.GetHostAddressesAsync("mongoMembership").ConfigureAwait(false);
var config = ClusterConfiguration.LocalhostPrimarySilo(10300, 10400);
config.AddMongoDBStorageProvider("mongoStorageProvider", options =>
{
options.UseJsonFormat = true;
options.ConnectionString = $"mongodb://admin:****@{storage.First().ToString()}:27018/Orleans";
options.DatabaseName = "storage";
});
var builder = new SiloHostBuilder()
.UseConfiguration(config)
.UseMongoDBMembershipTable(options =>
{
options.ConnectionString = $"mongodb://admin:****@{membership.First().ToString()}:27017/Orleans";
options.DatabaseName = "membership";
})
.UseMongoDBReminders(options =>
{
options.ConnectionString = $"mongodb://admin:****@{membership.First().ToString()}:27017/Orleans";
options.DatabaseName = "reminders";
})
.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(PlayerGrain).Assembly).WithReferences())
.ConfigureLogging(logging =>
{
logging.AddConsole();
logging.SetMinimumLevel(LogLevel.Warning);
});
Hi,
I haven't connected to docker container before with this provider, but I wouldn't think there would be a problem. Are you able to connect from your dev pc using the same config? I see you are using two different mongo ports, 27017 & 27018. Could this be the problem?
If not, could you please try and connect via a custom application using the same MongoDrivers. If that works please try isolating the different components, i.e) Switch off the membership provider and try the storage provider, etc.
My dev pc is down at the moment as I'm waiting for a drive replacement, so I'll only be able to look at this at a later stage.
I don't think ports could be problem because i'm able to connect to both of those servers using MongoDriver from same application.
I'll try to figure out component causing this issue...
Why are you not using the host name instead?
It behaves in the same way when using host name and ip
I digged into codebase and wasn't able to find root of this issue. Looks like i should better use other provider for now.
Thanks for trying to help
I have used the provider with Kubernetes. Would be nice, if you help us to investigate this problem.
Hi @astaror, this works for me:
https://gist.github.com/bboyle1234/4ed79eae38b82b8519958cf26fc87f5f
It's using the latest 2.0.0-rc3 release, which came out since your post.