Connecting to ES cluster using the .net client

I’ve created a test cluster on my dev machine using docker-compose and I’m having issues getting the .net client to connect.
Below is the docker-compose.yml file and the c# code used to test connection. The c# code is commented with details about the connection problem.

await ConnectAsync() seems to work.

I’ve stepped through execution of the client api code. It downloads the list of three ES nodes but seems to fail while establishing a tcp connection to one of them.

I’m not able to work out (yet) why the tcp connection is failing to establish.

The ES nodes themselves are clustering ok, and I’ve also pasted the results of a call to http://127.0.0.1:12113/gossip?format=json

For easier reading, I’ve also pasted the below code in this gist: https://gist.github.com/bboyle1234/51c4132e1223624d75ae7d0e80036d80

docker-compose.yml

version: ‘2’

services:

eventstore1:

image: eventstore/eventstore

ports:

  • 12113:2113/tcp

  • 11113:1113/tcp

environment:

EVENTSTORE_CLUSTER_DNS: eventstore1

EVENTSTORE_CLUSTER_GOSSIP_PORT: ‘2112’

EVENTSTORE_CLUSTER_SIZE: ‘3’

EVENTSTORE_EXT_HTTP_PORT_ADVERTISE_AS: ‘12113’

EVENTSTORE_EXT_TCP_PORT_ADVERTISE_AS: ‘11113’

EVENTSTORE_EXT_IP: ‘127.0.0.1’

EVENTSTORE_EXT_IP_ADVERTISE_AS: ‘127.0.0.1’

EVENTSTORE_RUN_PROJECTIONS: ‘All’

EVENTSTORE_START_STANDARD_PROJECTIONS: ‘True’

entrypoint:

  • /bin/bash

command:

  • -c

  • ‘sed -i “/IntIpAdvertiseAs:/d” /etc/eventstore/eventstore.conf && echo “IntIpAdvertiseAs: $$(hostname -i)” >> /etc/eventstore/eventstore.conf && sed -i “/IntIp:/d” /etc/eventstore/eventstore.conf && echo “IntIp: $$(hostname -i)” >> /etc/eventstore/eventstore.conf && /entrypoint.sh’

eventstore2:

image: eventstore/eventstore

ports:

  • 22113:2113/tcp

  • 21113:1113/tcp

environment:

EVENTSTORE_CLUSTER_DNS: eventstore1

EVENTSTORE_CLUSTER_GOSSIP_PORT: ‘2112’

EVENTSTORE_CLUSTER_SIZE: ‘3’

EVENTSTORE_EXT_HTTP_PORT_ADVERTISE_AS: ‘22113’

EVENTSTORE_EXT_TCP_PORT_ADVERTISE_AS: ‘21113’

EVENTSTORE_EXT_IP: ‘127.0.0.1’

EVENTSTORE_EXT_IP_ADVERTISE_AS: ‘127.0.0.1’

EVENTSTORE_RUN_PROJECTIONS: ‘All’

EVENTSTORE_START_STANDARD_PROJECTIONS: ‘True’

entrypoint:

  • /bin/bash

command:

  • -c

  • ‘sed -i “/IntIpAdvertiseAs:/d” /etc/eventstore/eventstore.conf && echo “IntIpAdvertiseAs: $$(hostname -i)” >> /etc/eventstore/eventstore.conf && sed -i “/IntIp:/d” /etc/eventstore/eventstore.conf && echo “IntIp: $$(hostname -i)” >> /etc/eventstore/eventstore.conf && /entrypoint.sh’

eventstore3:

image: eventstore/eventstore

ports:

  • 32113:2113/tcp

  • 31113:1113/tcp

environment:

EVENTSTORE_CLUSTER_DNS: eventstore1

EVENTSTORE_CLUSTER_GOSSIP_PORT: ‘2112’

EVENTSTORE_CLUSTER_SIZE: ‘3’

EVENTSTORE_EXT_HTTP_PORT_ADVERTISE_AS: ‘32113’

EVENTSTORE_EXT_TCP_PORT_ADVERTISE_AS: ‘31113’

EVENTSTORE_EXT_IP: ‘127.0.0.1’

EVENTSTORE_EXT_IP_ADVERTISE_AS: ‘127.0.0.1’

EVENTSTORE_RUN_PROJECTIONS: ‘All’

EVENTSTORE_START_STANDARD_PROJECTIONS: ‘True’

entrypoint:

  • /bin/bash

command:

  • -c

  • ‘sed -i “/IntIpAdvertiseAs:/d” /etc/eventstore/eventstore.conf && echo “IntIpAdvertiseAs: $$(hostname -i)” >> /etc/eventstore/eventstore.conf && sed -i “/IntIp:/d” /etc/eventstore/eventstore.conf && echo “IntIp: $$(hostname -i)” >> /etc/eventstore/eventstore.conf && /entrypoint.sh’

Test.cs

using Microsoft.Extensions.DependencyInjection;

using Microsoft.Extensions.Logging;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using System;

using System.Net;

using System.Threading.Tasks;

using ESClusterSettings = EventStore.ClientAPI.ClusterSettings;

using ESConnection = EventStore.ClientAPI.EventStoreConnection;

using ESConnectionSettings = EventStore.ClientAPI.ConnectionSettings;

using ESUserCredentials = EventStore.ClientAPI.SystemData.UserCredentials;

namespace Apex.Events.EventStore.Test {

[TestClass]

public class EventStoreConnections {

[TestMethod]

public async Task ConnectToCluster() {

var tcs = new TaskCompletionSource();

var settings = ESConnectionSettings.Create()

.EnableVerboseLogging()

.SetDefaultUserCredentials(new ESUserCredentials(“admin”, “changeit”))

.Build();

var clusterSettings = ESClusterSettings.Create()

.DiscoverClusterViaGossipSeeds()

.SetGossipSeedEndPoints(new[]{

new IPEndPoint(IPAddress.Loopback, 12113),

})

.Build();

var connection = ESConnection.Create(settings, clusterSettings, “test connection”);

connection.Closed += (_, e) => {

// Happens after ten reconnection attempts.

tcs.SetException(new Exception(“Closed”));

};

connection.Connected += (_, e) => {

// Does not happen

tcs.SetResult(null);

};

connection.Disconnected += (_, e) => {

// Does not happen

tcs.SetException(new Exception(“Disconnected”));

};

connection.ErrorOccurred += (_, e) => {

// Does not happen

tcs.SetException(e.Exception);

};

connection.Reconnecting += (_, e) => {

// Happens 10 times

};

// This succeeds

await connection.ConnectAsync();

// This fails

await tcs.Task;

}

}

}

http://127.0.0.1:12113/gossip?format=json

{

“members”: Array[3][

{

“instanceId”: “17703a26-4a05-4a55-9ceb-51a1c09e1045”,

“timeStamp”: “2018-07-26T23:51:29.247396Z”,

“state”: “Slave”,

“isAlive”: true,

“internalTcpIp”: “172.18.0.5”,

“internalTcpPort”: 1112,

“internalSecureTcpPort”: 0,

“externalTcpIp”: “127.0.0.1”,

“externalTcpPort”: 31113,

“externalSecureTcpPort”: 0,

“internalHttpIp”: “172.18.0.5”,

“internalHttpPort”: 2112,

“externalHttpIp”: “127.0.0.1”,

“externalHttpPort”: 32113,

“lastCommitPosition”: 13193981,

“writerCheckpoint”: 13211895,

“chaserCheckpoint”: 13211895,

“epochPosition”: 642,

“epochNumber”: 1,

“epochId”: “0d753a79-8852-434e-9da0-aac19de67cce”,

“nodePriority”: 0

},

{

“instanceId”: “cc32a80c-a0a6-400e-8926-6274565a9ed2”,

“timeStamp”: “2018-07-26T23:51:29.558431Z”,

“state”: “Master”,

“isAlive”: true,

“internalTcpIp”: “172.18.0.4”,

“internalTcpPort”: 1112,

“internalSecureTcpPort”: 0,

“externalTcpIp”: “127.0.0.1”,

“externalTcpPort”: 11113,

“externalSecureTcpPort”: 0,

“internalHttpIp”: “172.18.0.4”,

“internalHttpPort”: 2112,

“externalHttpIp”: “127.0.0.1”,

“externalHttpPort”: 12113,

“lastCommitPosition”: 13193981,

“writerCheckpoint”: 13211895,

“chaserCheckpoint”: 13211895,

“epochPosition”: 642,

“epochNumber”: 1,

“epochId”: “0d753a79-8852-434e-9da0-aac19de67cce”,

“nodePriority”: 0

},

{

“instanceId”: “b6626ff3-f5c1-496b-8f8a-6048f6767e8a”,

“timeStamp”: “2018-07-26T23:51:28.489078Z”,

“state”: “Slave”,

“isAlive”: true,

“internalTcpIp”: “172.18.0.3”,

“internalTcpPort”: 1112,

“internalSecureTcpPort”: 0,

“externalTcpIp”: “127.0.0.1”,

“externalTcpPort”: 21113,

“externalSecureTcpPort”: 0,

“internalHttpIp”: “172.18.0.3”,

“internalHttpPort”: 2112,

“externalHttpIp”: “127.0.0.1”,

“externalHttpPort”: 22113,

“lastCommitPosition”: 13193981,

“writerCheckpoint”: 13211895,

“chaserCheckpoint”: 13211895,

“epochPosition”: 642,

“epochNumber”: 1,

“epochId”: “0d753a79-8852-434e-9da0-aac19de67cce”,

“nodePriority”: 0

}

],

“serverIp”: “172.18.0.4”,

“serverPort”: 2112

}

ESClient log file:

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.StartConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: StartConnection.

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

INFO: ClientAPI TcpConnection closed [00:46:37.553: N127.0.0.1:11113, L127.0.0.1:56816, {4606fdc5-3825-4140-a41e-6d4d0362da84}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56816, {4606fdc5-3825-4140-a41e-6d4d0362da84}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56816, {4606fdc5-3825-4140-a41e-6d4d0362da84}] closed…

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56816, {4606fdc5-3825-4140-a41e-6d4d0362da84}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {4606fdc5-3825-4140-a41e-6d4d0362da84}, conn.Id {4606fdc5-3825-4140-a41e-6d4d0362da84}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56816] established…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56818, {5e88f7f3-f0d0-4625-b398-cb8f92fe639e}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56818, {5e88f7f3-f0d0-4625-b398-cb8f92fe639e}] established…

INFO: ClientAPI TcpConnection closed [00:46:37.889: N127.0.0.1:11113, L127.0.0.1:56818, {5e88f7f3-f0d0-4625-b398-cb8f92fe639e}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56818, {5e88f7f3-f0d0-4625-b398-cb8f92fe639e}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56818, {5e88f7f3-f0d0-4625-b398-cb8f92fe639e}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56819, {1aeb9118-8715-415c-9b43-afe47778a3c0}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:38.086: N127.0.0.1:11113, L127.0.0.1:56819, {1aeb9118-8715-415c-9b43-afe47778a3c0}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56819, {1aeb9118-8715-415c-9b43-afe47778a3c0}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {1aeb9118-8715-415c-9b43-afe47778a3c0}, conn.Id {1aeb9118-8715-415c-9b43-afe47778a3c0}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56819] established…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56819, {1aeb9118-8715-415c-9b43-afe47778a3c0}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56821, {e3062f74-d579-4540-9e54-edd0ea0c7f6d}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:38.280: N127.0.0.1:11113, L127.0.0.1:56821, {e3062f74-d579-4540-9e54-edd0ea0c7f6d}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56821, {e3062f74-d579-4540-9e54-edd0ea0c7f6d}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {e3062f74-d579-4540-9e54-edd0ea0c7f6d}, conn.Id {e3062f74-d579-4540-9e54-edd0ea0c7f6d}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56821] established…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56821, {e3062f74-d579-4540-9e54-edd0ea0c7f6d}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56822, {f1850451-540f-4ed4-a543-19118de2f281}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {f1850451-540f-4ed4-a543-19118de2f281}, conn.Id {f1850451-540f-4ed4-a543-19118de2f281}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56822] established…

INFO: ClientAPI TcpConnection closed [00:46:38.479: N127.0.0.1:11113, L127.0.0.1:56822, {f1850451-540f-4ed4-a543-19118de2f281}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56822, {f1850451-540f-4ed4-a543-19118de2f281}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56822, {f1850451-540f-4ed4-a543-19118de2f281}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56823, {c1bf8ded-edc5-4585-aba2-d366aeef3d7a}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:38.681: N127.0.0.1:11113, L127.0.0.1:56823, {c1bf8ded-edc5-4585-aba2-d366aeef3d7a}]:

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {c1bf8ded-edc5-4585-aba2-d366aeef3d7a}, conn.Id {c1bf8ded-edc5-4585-aba2-d366aeef3d7a}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56823] established…

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56823, {c1bf8ded-edc5-4585-aba2-d366aeef3d7a}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56823, {c1bf8ded-edc5-4585-aba2-d366aeef3d7a}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56826, {57bfba34-1a18-46c3-9e20-7ad5bb636220}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:39.093: N127.0.0.1:11113, L127.0.0.1:56826, {57bfba34-1a18-46c3-9e20-7ad5bb636220}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56826, {57bfba34-1a18-46c3-9e20-7ad5bb636220}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {57bfba34-1a18-46c3-9e20-7ad5bb636220}, conn.Id {57bfba34-1a18-46c3-9e20-7ad5bb636220}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56826] established…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56826, {57bfba34-1a18-46c3-9e20-7ad5bb636220}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56827, {11279a4a-3c81-47a4-bd1b-52d3d0ff895e}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:39.290: N127.0.0.1:11113, L127.0.0.1:56827, {11279a4a-3c81-47a4-bd1b-52d3d0ff895e}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {11279a4a-3c81-47a4-bd1b-52d3d0ff895e}, conn.Id {11279a4a-3c81-47a4-bd1b-52d3d0ff895e}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56827] established…

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56827, {11279a4a-3c81-47a4-bd1b-52d3d0ff895e}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56827, {11279a4a-3c81-47a4-bd1b-52d3d0ff895e}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56830, {a145929e-8262-409a-8f8f-c2a0547dcaf5}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {a145929e-8262-409a-8f8f-c2a0547dcaf5}, conn.Id {a145929e-8262-409a-8f8f-c2a0547dcaf5}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56830] established…

INFO: ClientAPI TcpConnection closed [00:46:39.686: N127.0.0.1:11113, L127.0.0.1:56830, {a145929e-8262-409a-8f8f-c2a0547dcaf5}]:

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56830, {a145929e-8262-409a-8f8f-c2a0547dcaf5}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56830, {a145929e-8262-409a-8f8f-c2a0547dcaf5}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56831, {add2ebc0-e96c-4487-afd2-c0e9ac52b16c}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:39.879: N127.0.0.1:11113, L127.0.0.1:56831, {add2ebc0-e96c-4487-afd2-c0e9ac52b16c}]:

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {add2ebc0-e96c-4487-afd2-c0e9ac52b16c}, conn.Id {add2ebc0-e96c-4487-afd2-c0e9ac52b16c}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56831] established…

INFO: Received bytes: 0, Sent bytes: 0

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56831, {add2ebc0-e96c-4487-afd2-c0e9ac52b16c}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56831, {add2ebc0-e96c-4487-afd2-c0e9ac52b16c}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: DiscoverEndPoint.

INFO: Discovering: found best choice [127.0.0.1:11113,n/a] (Master).

INFO: Discovering attempt 1/10 successful: best candidate is [127.0.0.1:11113, n/a].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.EstablishTcpConnectionMessage…

DEBUG: EventStoreConnection ‘test connection’: EstablishTcpConnection to [127.0.0.1:11113].

DEBUG: TcpPackageConnection: connected to [127.0.0.1:11113, L127.0.0.1:56832, {2de0e55d-c1d2-4b42-a64e-f2b674395760}].

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionEstablishedMessage…

INFO: ClientAPI TcpConnection closed [00:46:40.293: N127.0.0.1:11113, L127.0.0.1:56832, {2de0e55d-c1d2-4b42-a64e-f2b674395760}]:

INFO: Received bytes: 0, Sent bytes: 0

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state Connecting, _conn.Id {2de0e55d-c1d2-4b42-a64e-f2b674395760}, conn.Id {2de0e55d-c1d2-4b42-a64e-f2b674395760}, conn.closed True): TCP connection to [127.0.0.1:11113, L127.0.0.1:56832] established…

INFO: Send calls: 0, callbacks: 0

INFO: Receive calls: 1, callbacks: 1

INFO: Close reason: [Success] Socket closed

DEBUG: TcpPackageConnection: connection [127.0.0.1:11113, L127.0.0.1:56832, {2de0e55d-c1d2-4b42-a64e-f2b674395760}] was closed cleanly.

DEBUG: EventStoreConnection ‘test connection’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…

DEBUG: EventStoreConnection ‘test connection’: TCP connection to [127.0.0.1:11113, L127.0.0.1:56832, {2de0e55d-c1d2-4b42-a64e-f2b674395760}] closed…

DEBUG: EventStoreConnection ‘test connection’: TimerTick checking reconnection…

DEBUG: EventStoreConnection ‘test connection’: CloseConnection, reason Reconnection limit reached., exception …

DEBUG: EventStoreConnection ‘test connection’: CloseTcpConnection.

DEBUG: EventStoreConnection ‘test connection’: IGNORED (_state: Closed, _conn.ID: {2de0e55d-c1d2-4b42-a64e-f2b674395760}, conn.ID: {2de0e55d-c1d2-4b42-a64e-f2b674395760}): TCP connection to [127.0.0.1:11113, L127.0.0.1:56832] closed…

INFO: EventStoreConnection ‘test connection’: Closed. Reason: Reconnection limit reached…

It looks like the problem might have something to do with EventStore authentication only working on the internal connections.
It seems that the EventStore.Client is setup to use external connections only, when clustering options are used.

Is this correct? Is there a way to connect EventStore.Client to a cluster via the external ports?

If I configure ssl in EventStore, will the client be able to connect to a cluster’s external secure tcp ports and authenticate while EventStore is setup to use the default “internal” authenticaion plugin?

If not, it looks to me as though I need to modify EventStore.Client to allow configuration for connecting to a cluster using the internal endpoints, which I’m happy to do and make a pull request as well.