I’ve setup a super-simple test scenario just to try and get EventStore.Client connecting to an eventstore cluster, but no matter what I do, it’s just not working. Hopefully someone can help me put a finger on my issue.
First, I ran command docker network create esclienttest to create a network to host my test on.
Then, I created the following docker-compose which sets up the EventStore cluster and my test program on that network:
version: ‘3.4’
services:
esclienttest:
image: esclienttest
build:
context: .
dockerfile: ESClientTest/Dockerfile
depends_on:
- eventstore1
- eventstore2
- eventstore3
eventstore1:
image: eventstore/eventstore
hostname: eventstore1
ports:
- 2113:2113
environment:
EVENTSTORE_CLUSTER_DNS: eventstore1
EVENTSTORE_CLUSTER_SIZE: 3
EVENTSTORE_CLUSTER_GOSSIP_PORT: 2112
eventstore2:
image: eventstore/eventstore
hostname: eventstore2
environment:
EVENTSTORE_CLUSTER_DNS: eventstore1
EVENTSTORE_CLUSTER_SIZE: 3
EVENTSTORE_CLUSTER_GOSSIP_PORT: 2112
eventstore3:
image: eventstore/eventstore
hostname: eventstore3
environment:
EVENTSTORE_CLUSTER_DNS: eventstore1
EVENTSTORE_CLUSTER_SIZE: 3
EVENTSTORE_CLUSTER_GOSSIP_PORT: 2112
networks:
default:
external:
name: esclienttest
My test program contained the following code:
using EventStore.ClientAPI;
using EventStore.ClientAPI.SystemData;
using Nito.AsyncEx;
using System;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
namespace ESClientTest {
class Program {
static async Task Main(string[] args) {
var mre = new AsyncManualResetEvent(false);
var settings = ConnectionSettings.Create()
.UseConsoleLogger()
.UseDebugLogger()
.EnableVerboseLogging()
.SetOperationTimeoutTo(Debugger.IsAttached ? TimeSpan.FromMinutes(30) : TimeSpan.FromSeconds(2));
var connection = EventStoreConnection.Create(“ConnectTo=discover://admin:changeit@eventstore1:2112”, settings, “hello world”);
connection.Closed += (_, e) => {
};
connection.Connected += (_, e) => {
mre.Set();
};
connection.Disconnected += (_, e) => {
};
connection.ErrorOccurred += (_, e) => {
};
connection.Reconnecting += (_, e) => {
};
await connection.ConnectAsync();
await mre.WaitAsync();
}
}
}
I’ve tried every overload, every combination of cluster connection configuration I can think of. I’ve verified that the evenstore instances are definitely happily connected together.
I’ve verified that “eventstore1” does resolve to an IPv4
Here is the resulting program output: