<div dir="ltr">Hi all.<div><br></div><div>I am leaning rabbitmq use haproxy to execute failover in a cluster.</div><div><br></div><div>IP server rabbitmq_1: 10.0.0.101 port: 15672</div><div>IP server rabbitmq_2: 192.168.247.129 port: 15672<br></div><div>IP server haproxy: 192.168.247.131</div><div><br></div><div>Haproxy config</div><div><br></div><div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"># HAProxy Config for Local RabbitMQ SLB Warren</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);">global</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>log 127.0.0.1 local0 info</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>maxconn 4096</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>daemon</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>nbproc 1</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);">defaults</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>log global</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>mode tcp</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>option tcplog</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>option dontlognull</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>retries 3</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>option redispatch</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>maxconn 2000</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>timeout connect 5s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>timeout client 120s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>timeout server 120s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);">listen rabbitmq_local_cluster 192.168.247.131:8088</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>mode tcp</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>balance roundrobin</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>server rabbit_a 10.0.0.101:15672 check inter 5000 rise 2 fall 3</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>server rabbit_b 192.168.247.129:15672 backup inter 5000 rise 2 fall 3</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);">listen private_monitoring :8101</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>mode http</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>log global</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><br></font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>maxconn 10</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><br></font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>clitimeout 100s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> srvtimeout 100s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> contimeout 100s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> timeout queue 100s</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><br></font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>option httplog</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>stats hide-version</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>stats show-node</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>stats enable</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>stats auth admin:123456</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>stats uri /stats</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>stats refresh 5s</font></div></div><div><br></div><div>Code APP send message</div><div><br></div><div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);">class Send</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> {</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> public static void Main()</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> {</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> var factory = new ConnectionFactory { HostName = "192.168.247.131", Port=8088 };</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> using (var connection = factory.CreateConnection())</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> {</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> using (var channel = connection.CreateModel())</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> {</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> //channel.QueueDeclare("hello", false, false, false, null);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> channel.QueueDeclare("q_A", false, false, false, null);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> channel.QueueDeclare("q_B", false, false, false, null);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> int i = 0;</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> while (true)</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> {</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> string message = "Hello World! " + i.ToString();</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> var body = Encoding.UTF8.GetBytes(message);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"><br></font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> channel.BasicPublish("", "q_A", null, body);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> channel.BasicPublish("", "q_B", null, body);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> Console.WriteLine(" [x] Sent {0}", message);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> i++;</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> Thread.Sleep(1000);</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> }</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> }</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> }</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> Console.Read();</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> }</font></div><div><font color="#ff9900" style="background-color: rgb(0, 0, 0);"> }</font></div></div><div><br></div><div><br></div><div>pls help me.</div><div><br></div><div>Thanks so muck.</div><div><br>On Thursday, 16 July 2009 21:45:56 UTC+7, Tammo....@btc-ag.com wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div>
<font face="Calibri, sans-serif" size="2">
<div>Hy,</div>
<div> </div>
<div>i´m building a client server .net application that uses rabbitmq as mom.</div>
<div> </div>
<div>the code i´m using to pulish messages is:</div>
<div> </div>
<div><font color="#2B91AF"> <font face="Courier New, monospace" size="2"> IProtocol</font><font face="Courier New, monospace" size="2" color="#000000"> protocol = </font><font face="Courier New, monospace" size="2">Protocols</font><font face="Courier New, monospace" size="2" color="#000000">.FromEnvironment();</font></font></div>
<div><font face="Courier New, monospace" size="2"> <font color="#2B91AF">IConnection</font> conn = factory.CreateConnection(<wbr>rmqBrokerUrl);</font></div>
<div><font face="Courier New, monospace" size="2"> <font color="#2B91AF">IModel</font> channel = conn.CreateModel();</font></div>
<div><font face="Courier New, monospace" size="2"> conn.AutoClose = <font color="#0000FF">true</font>;</font></div>
<div><font face="Courier New, monospace" size="2"> <font color="#2B91AF">IBasicProperties</font> props = channel.CreateBasicProperties(<wbr>);</font></div>
<div><font face="Courier New, monospace" size="2"> channel.BasicPublish(exchange, routingKey, props, buffer);</font></div>
<div><font face="Courier New, monospace" size="2"> channel.Close(200, <font color="#A31515">"Goodbye"</font>);</font></div>
<div><font face="Courier New, monospace" size="2"> </font></div>
<div> </div>
<div> </div>
<div> </div>
<div>after sending about 4000msg each in a single thread using the above code, im getting error that states:</div>
<div> </div>
<div>"None of the specified endpoints were reachable".</div>
<div> </div>
<div> </div>
<div> </div>
<div>any hints on this?</div>
<div> </div>
<div>thanks a lot,</div>
<div> </div>
<div>Tammo</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</font>
</div>
</blockquote></div></div>