Troubles with connecting to local cluster

70 views
Skip to first unread message

Pavel Rodnyansky

unread,
Mar 6, 2018, 5:58:52 AM3/6/18
to masstransit-discuss
Hi. I am trying to connect masstransit to existing single machine rabbitmq cluster and getting weird errors. I Am new to rabbitmq and masstransit so it s totally possible that i am doing something wrong. I tried to setup masstransit according with following discussions: https://groups.google.com/forum/#!topic/masstransit-discuss/s9YIkeyVcLI , https://groups.google.com/forum/#!topic/masstransit-discuss/xkDgUaSQpsE but with no success. My cluster is totally working, i was able to connect to different nodes simultaneously and exchange messages between them via MassTransit like in this example.

Here is my cluster setup:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.3\sbin>rabbitmqctl -n rabbit1 cluster_status
Cluster status of node rabbit1@pavel ...
[{nodes,[{disc,[rabbit1@pavel,rabbit2@pavel]}]},
 {running_nodes,[rabbit2@pavel,rabbit1@pavel]},
 {cluster_name,<<"rab...@pavel.dev.local">>},
 {partitions,[]},
 {alarms,[{rabbit2@pavel,[]},{rabbit1@pavel,[]}]}]

And this is how i registered it: As you can see i experimented with different settings.

var host = busFactoryConfigurator.Host(new Uri("rabbitmq://rab...@pavel.dev.local"), settings =>
    
{
         settings
.Username("admin");
         settings
.Password("admin");
         settings
.UseCluster(c =>
         
{
             //c.ClusterMembers = new[] { "rabbitmq://localhost:5672", "rabbitmq://localhost:5673" };
             
//c.ClusterMembers = new[] { "rabbit1@pavel:5672", "rabbit2@pavel:5673" };
             c
.ClusterMembers = new[] { "rabbit1", "rabbit2" };
        
});
    
});

This is what i get when calling _bus.Start():

MassTransit.RabbitMqTransport.RabbitMqConnectionException
  HResult=0x80131500
  Message=Broker unreachable: ad...@pavel.dev.local:5672/
  Source=MassTransit.RabbitMqTransport
  StackTrace:
   at MassTransit.RabbitMqTransport.Integration.ConnectionContextFactory.<CreateConnection>d__9.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.RabbitMqTransport.Integration.ConnectionContextFactory.<CreateSharedConnection>d__8.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at GreenPipes.Agents.PipeContextSupervisor`1.<GreenPipes-IPipeContextSource<TContext>-Send>d__6.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at GreenPipes.Agents.PipeContextSupervisor`1.<GreenPipes-IPipeContextSource<TContext>-Send>d__6.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at GreenPipes.Agents.PipeContextSupervisor`1.<GreenPipes-IPipeContextSource<TContext>-Send>d__6.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.RabbitMqTransport.Transport.RabbitMqReceiveTransport.<<Receiver>b__15_0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.RabbitMqTransport.Transport.RabbitMqHost.Handle.<ReadyOrNot>d__7.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.MassTransitBus.Handle.<ReadyOrNot>d__10.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.Internals.Extensions.TaskExtensions.<UntilCompletedOrCanceled>d__0`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.MassTransitBus.<StartAsync>d__28.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at MassTransit.RabbitMqTransport.Transport.RabbitMqReceiveTransport.<<Receiver>b__15_0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.Policies.PipeRetryExtensions.<Retry>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at MassTransit.MassTransitBus.<StartAsync>d__28.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.Util.TaskUtil.Await[T](Func`1 taskFactory, CancellationToken cancellationToken)
   at MassTransit.BusControlExtensions.Start(IBusControl busControl)
   at EventBus.Implementation.SmetaEventBus.Start() in C:\TeamServer\Smeta X\TestProjects\ServiceCommunicationTest\EventBus\Implementation\MassTransit\SmetaEventBus.cs:line 41
   at MassTransitSender.MassTransitSender.Main(String[] args) in C:\TeamServer\Smeta X\TestProjects\ServiceCommunicationTest\MassTransitSender\MassTransitSender.cs:line 42

Inner Exception 1:
BrokerUnreachableException: None of the specified endpoints were reachable

Inner Exception 2:
AggregateException: One or more errors occurred. (Connection failed) (Connection failed)

Inner Exception 3:
ConnectFailureException: Connection failed

Inner Exception 4:
SocketException: Этот хост неизвестен


I am struggling for couple of days already, any advise would be helpful.

Chris Patterson

unread,
Mar 6, 2018, 11:57:19 AM3/6/18
to masstrans...@googlegroups.com
You should be using the RabbitMQ node URL's to build the cluster, not the Erlang node names (those don't even resolve).


That explains it, and it hasn't really changed.




On Tue, Mar 6, 2018 at 2:58 AM, Pavel Rodnyansky <rodnya...@gmail.com> wrote:
Hi. I am trying to connect masstransit to existing single machine rabbitmq cluster and getting weird errors. I Am new to rabbitmq and masstransit so it s totally possible that i am doing something wrong. I tried to setup masstransit according with following discussions: https://groups.google.com/forum/#!topic/masstransit-discuss/s9YIkeyVcLI , https://groups.google.com/forum/#!topic/masstransit-discuss/xkDgUaSQpsE but with no success. My cluster is totally working, i was able to connect to different nodes simultaneously and exchange messages between them via MassTransit like in this example.

Here is my cluster setup:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.3\sbin>rabbitmqctl -n rabbit1 cluster_status
Cluster status of node rabbit1@pavel ...
[{nodes,[{disc,[rabbit1@pavel,rabbit2@pavel]}]},
 {running_nodes,[rabbit2@pavel,rabbit1@pavel]},
 {cluster_name,<<"rabbit1@pavel.dev.local">>},
 {partitions,[]},
 {alarms,[{rabbit2@pavel,[]},{rabbit1@pavel,[]}]}]

And this is how i registered it: As you can see i experimented with different settings.

var host = busFactoryConfigurator.Host(new Uri("rabbitmq://rabbit1@pavel.dev.local"), settings =>

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/17c9279c-64b4-4653-9003-c07a5c37952c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pavel Rodnyansky

unread,
Mar 7, 2018, 2:59:47 AM3/7/18
to masstransit-discuss
Thanks for the fast response. I tried the example you provided before, i connected my sender and reciever apps to different nodes directly (without using "UseCluster" setting) and successfilly exchanged messages through the cluster. But now i want to build a resilient cluster and i want masstransit to reconnect to another running node if one of the nodes goes down. This feature  is not documented and not covered in the example, but if i understand correctly is possible to do in latest MassTransit. 
According to this link my config section should look something like this:
        var host = busFactoryConfigurator.Host(new Uri("rabbitmq://rab...@pavel.dev.local"), settings =>
       
{
            settings
.Username("admin");
            settings
.Password("admin");
            settings
.UseCluster(c =>
           
{

                c
.ClusterMembers = new[] { "rabbitmq://127.0.0.1:5672", "rabbitmq://127.0.0.1:5673" };
           
});
       
});

I m still getting 'Broker unreachable: ad...@pavel.dev.local:5672/' on _bus.Start().
Can you please provide a code with correct settings?

Chris Patterson

unread,
Mar 7, 2018, 11:56:35 AM3/7/18
to masstrans...@googlegroups.com
I honestly don't know, look at the unit tests and see if they shed some light.

I didn't code this feature, and have never used it, so I don't know how it works.

I think you need a shared name on the first URI after the .Host(new Uri("rabbitmq://mycluster"), ...) but I'm not certain as I have never used clustering this way.

Reply all
Reply to author
Forward
0 new messages