You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Dennis Holunder <de...@gmail.com> on 2018/01/09 11:55:27 UTC

zookeeper leader selection selects multiple leaders

Hello,

I'm using zookeeper route policy for leader selection on 8 instances
of my route and get sometimes 2 leaders selected. What I'm doing wrong
here?

String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";

ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
policy.setShouldStopConsumer(false);

from("cron").routePolicy(policy).log("started");

Denny

Re: zookeeper leader selection selects multiple leaders

Posted by Dennis Holunder <de...@gmail.com>.
Hi Claus,

now it is working as expected. The problem was elsewhere. The CDI
produced Weld Proxy for MasterRoutePolicy and it didn't work, because
I have some 'policy instanceof MasterRoutePolicy' check returning
false
After fixing it, looks like the leader is selected properly



2018-01-09 16:51 GMT+01:00 Claus Ibsen-2 [via Camel]
<ml...@n5.nabble.com>:
> Yeah I think it does. Can you give it a try, and we can improve the docs.
>
> On Tue, Jan 9, 2018 at 4:47 PM, Dennis Holunder <[hidden email]> wrote:
>
>> thank you!
>> Does it support multiple zookeeper comma-separated URLs? The example
>> in docs uses just one localhost
>>
>> masterRoutePolicy.setZooKeeperUrl("host1:2181,host2:2181,host3:2181");
>>
>> 2018-01-09 16:25 GMT+01:00 Claus Ibsen-2 [via Camel]
>> <[hidden email]>:
>>> Yes check its doc page
>>>
>>> https://github.com/apache/camel/blob/master/components/camel-zookeeper-master/src/main/docs/zookeeper-master-component.adoc
>>>
>>> And its also covered in the CiA2 book in the clustering chapter.
>>>
>>> On Tue, Jan 9, 2018 at 1:38 PM, Dennis Holunder <[hidden email]> wrote:
>>>
>>>> Is there any documentation or example usage of zookeeper-master
>>>> component?
>>>>
>>>> 2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
>>>> <[hidden email]>:
>>>>> Try the zookeeper-master component - it should be better
>>>>>
>>>>> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]>
>>>>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm using zookeeper route policy for leader selection on 8 instances
>>>>>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>>>>>> here?
>>>>>>
>>>>>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>>>>>
>>>>>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>>>>>> policy.setShouldStopConsumer(false);
>>>>>>
>>>>>> from("cron").routePolicy(policy).log("started");
>>>>>>
>>>>>> Denny
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> -----------------
>>>>> http://davsclaus.com @davsclaus
>>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>>>
>>>>>
>>>>> ________________________________
>>>>> If you reply to this email, your message will be added to the
>>>>> discussion
>>>>> below:
>>>>>
>>>>>
>>>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
>>>>> To unsubscribe from Camel, click here.
>>>>> NAML
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816563.html
>>> To unsubscribe from Camel, click here.
>>> NAML
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816565.html
> To unsubscribe from Camel, click here.
> NAML

Re: zookeeper leader selection selects multiple leaders

Posted by Dennis Holunder <de...@gmail.com>.
Sorry, I have to correct myself it didn't start at all on all
machines. So, still not working for me. In logs I see just

09:11:33 [main] INFO  o.a.camel.impl.DefaultCamelContext - Skipping
starting of route myId as its configured with autoStartup=false
09:11:33 [main] INFO  o.a.camel.impl.DefaultCamelContext - Total 9
routes, of which 8 are started
09:11:33 [main] INFO  o.a.camel.impl.DefaultCamelContext - Apache
Camel 2.20.1 (CamelContext: camel-1) started in 0.348 seconds

2018-01-10 9:43 GMT+01:00 Dennis Holunder <de...@gmail.com>:
> Tried. Leader selection with MasterRoutePolicy didn't work at all. All
> instances started the route and no errors or any hints were reported
>
> MasterRoutePolicy master = new MasterRoutePolicy();
>     master.setZooKeeperUrl("host1:2181,host2:2181");
>     master.setZkRoot("/route/root");
>     master.setGroupName("myGroup");
>
>     from("quartz:cron").noAutoStartup().routePolicy(master).log("done");
>
>
> 2018-01-09 16:51 GMT+01:00 Claus Ibsen-2 [via Camel]
> <ml...@n5.nabble.com>:
>> Yeah I think it does. Can you give it a try, and we can improve the docs.
>>
>> On Tue, Jan 9, 2018 at 4:47 PM, Dennis Holunder <[hidden email]> wrote:
>>
>>> thank you!
>>> Does it support multiple zookeeper comma-separated URLs? The example
>>> in docs uses just one localhost
>>>
>>> masterRoutePolicy.setZooKeeperUrl("host1:2181,host2:2181,host3:2181");
>>>
>>> 2018-01-09 16:25 GMT+01:00 Claus Ibsen-2 [via Camel]
>>> <[hidden email]>:
>>>> Yes check its doc page
>>>>
>>>> https://github.com/apache/camel/blob/master/components/camel-zookeeper-master/src/main/docs/zookeeper-master-component.adoc
>>>>
>>>> And its also covered in the CiA2 book in the clustering chapter.
>>>>
>>>> On Tue, Jan 9, 2018 at 1:38 PM, Dennis Holunder <[hidden email]> wrote:
>>>>
>>>>> Is there any documentation or example usage of zookeeper-master
>>>>> component?
>>>>>
>>>>> 2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
>>>>> <[hidden email]>:
>>>>>> Try the zookeeper-master component - it should be better
>>>>>>
>>>>>> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm using zookeeper route policy for leader selection on 8 instances
>>>>>>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>>>>>>> here?
>>>>>>>
>>>>>>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>>>>>>
>>>>>>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>>>>>>> policy.setShouldStopConsumer(false);
>>>>>>>
>>>>>>> from("cron").routePolicy(policy).log("started");
>>>>>>>
>>>>>>> Denny
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> -----------------
>>>>>> http://davsclaus.com @davsclaus
>>>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>>>>
>>>>>>
>>>>>> ________________________________
>>>>>> If you reply to this email, your message will be added to the
>>>>>> discussion
>>>>>> below:
>>>>>>
>>>>>>
>>>>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
>>>>>> To unsubscribe from Camel, click here.
>>>>>> NAML
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> -----------------
>>>> http://davsclaus.com @davsclaus
>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>>
>>>>
>>>> ________________________________
>>>> If you reply to this email, your message will be added to the discussion
>>>> below:
>>>>
>>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816563.html
>>>> To unsubscribe from Camel, click here.
>>>> NAML
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816565.html
>> To unsubscribe from Camel, click here.
>> NAML

Re: zookeeper leader selection selects multiple leaders

Posted by Dennis Holunder <de...@gmail.com>.
Tried. Leader selection with MasterRoutePolicy didn't work at all. All
instances started the route and no errors or any hints were reported

MasterRoutePolicy master = new MasterRoutePolicy();
    master.setZooKeeperUrl("host1:2181,host2:2181");
    master.setZkRoot("/route/root");
    master.setGroupName("myGroup");

    from("quartz:cron").noAutoStartup().routePolicy(master).log("done");


2018-01-09 16:51 GMT+01:00 Claus Ibsen-2 [via Camel]
<ml...@n5.nabble.com>:
> Yeah I think it does. Can you give it a try, and we can improve the docs.
>
> On Tue, Jan 9, 2018 at 4:47 PM, Dennis Holunder <[hidden email]> wrote:
>
>> thank you!
>> Does it support multiple zookeeper comma-separated URLs? The example
>> in docs uses just one localhost
>>
>> masterRoutePolicy.setZooKeeperUrl("host1:2181,host2:2181,host3:2181");
>>
>> 2018-01-09 16:25 GMT+01:00 Claus Ibsen-2 [via Camel]
>> <[hidden email]>:
>>> Yes check its doc page
>>>
>>> https://github.com/apache/camel/blob/master/components/camel-zookeeper-master/src/main/docs/zookeeper-master-component.adoc
>>>
>>> And its also covered in the CiA2 book in the clustering chapter.
>>>
>>> On Tue, Jan 9, 2018 at 1:38 PM, Dennis Holunder <[hidden email]> wrote:
>>>
>>>> Is there any documentation or example usage of zookeeper-master
>>>> component?
>>>>
>>>> 2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
>>>> <[hidden email]>:
>>>>> Try the zookeeper-master component - it should be better
>>>>>
>>>>> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]>
>>>>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm using zookeeper route policy for leader selection on 8 instances
>>>>>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>>>>>> here?
>>>>>>
>>>>>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>>>>>
>>>>>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>>>>>> policy.setShouldStopConsumer(false);
>>>>>>
>>>>>> from("cron").routePolicy(policy).log("started");
>>>>>>
>>>>>> Denny
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> -----------------
>>>>> http://davsclaus.com @davsclaus
>>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>>>
>>>>>
>>>>> ________________________________
>>>>> If you reply to this email, your message will be added to the
>>>>> discussion
>>>>> below:
>>>>>
>>>>>
>>>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
>>>>> To unsubscribe from Camel, click here.
>>>>> NAML
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816563.html
>>> To unsubscribe from Camel, click here.
>>> NAML
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816565.html
> To unsubscribe from Camel, click here.
> NAML

Re: zookeeper leader selection selects multiple leaders

Posted by Claus Ibsen <cl...@gmail.com>.
Yeah I think it does. Can you give it a try, and we can improve the docs.

On Tue, Jan 9, 2018 at 4:47 PM, Dennis Holunder <de...@gmail.com> wrote:
> thank you!
> Does it support multiple zookeeper comma-separated URLs? The example
> in docs uses just one localhost
>
> masterRoutePolicy.setZooKeeperUrl("host1:2181,host2:2181,host3:2181");
>
> 2018-01-09 16:25 GMT+01:00 Claus Ibsen-2 [via Camel]
> <ml...@n5.nabble.com>:
>> Yes check its doc page
>> https://github.com/apache/camel/blob/master/components/camel-zookeeper-master/src/main/docs/zookeeper-master-component.adoc
>>
>> And its also covered in the CiA2 book in the clustering chapter.
>>
>> On Tue, Jan 9, 2018 at 1:38 PM, Dennis Holunder <[hidden email]> wrote:
>>
>>> Is there any documentation or example usage of zookeeper-master component?
>>>
>>> 2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
>>> <[hidden email]>:
>>>> Try the zookeeper-master component - it should be better
>>>>
>>>> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I'm using zookeeper route policy for leader selection on 8 instances
>>>>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>>>>> here?
>>>>>
>>>>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>>>>
>>>>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>>>>> policy.setShouldStopConsumer(false);
>>>>>
>>>>> from("cron").routePolicy(policy).log("started");
>>>>>
>>>>> Denny
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> -----------------
>>>> http://davsclaus.com @davsclaus
>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>>
>>>>
>>>> ________________________________
>>>> If you reply to this email, your message will be added to the discussion
>>>> below:
>>>>
>>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
>>>> To unsubscribe from Camel, click here.
>>>> NAML
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816563.html
>> To unsubscribe from Camel, click here.
>> NAML



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: zookeeper leader selection selects multiple leaders

Posted by Dennis Holunder <de...@gmail.com>.
thank you!
Does it support multiple zookeeper comma-separated URLs? The example
in docs uses just one localhost

masterRoutePolicy.setZooKeeperUrl("host1:2181,host2:2181,host3:2181");

2018-01-09 16:25 GMT+01:00 Claus Ibsen-2 [via Camel]
<ml...@n5.nabble.com>:
> Yes check its doc page
> https://github.com/apache/camel/blob/master/components/camel-zookeeper-master/src/main/docs/zookeeper-master-component.adoc
>
> And its also covered in the CiA2 book in the clustering chapter.
>
> On Tue, Jan 9, 2018 at 1:38 PM, Dennis Holunder <[hidden email]> wrote:
>
>> Is there any documentation or example usage of zookeeper-master component?
>>
>> 2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
>> <[hidden email]>:
>>> Try the zookeeper-master component - it should be better
>>>
>>> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm using zookeeper route policy for leader selection on 8 instances
>>>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>>>> here?
>>>>
>>>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>>>
>>>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>>>> policy.setShouldStopConsumer(false);
>>>>
>>>> from("cron").routePolicy(policy).log("started");
>>>>
>>>> Denny
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
>>> To unsubscribe from Camel, click here.
>>> NAML
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816563.html
> To unsubscribe from Camel, click here.
> NAML

Re: zookeeper leader selection selects multiple leaders

Posted by Claus Ibsen <cl...@gmail.com>.
Yes check its doc page
https://github.com/apache/camel/blob/master/components/camel-zookeeper-master/src/main/docs/zookeeper-master-component.adoc

And its also covered in the CiA2 book in the clustering chapter.

On Tue, Jan 9, 2018 at 1:38 PM, Dennis Holunder <de...@gmail.com> wrote:
> Is there any documentation or example usage of zookeeper-master component?
>
> 2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
> <ml...@n5.nabble.com>:
>> Try the zookeeper-master component - it should be better
>>
>> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]> wrote:
>>
>>> Hello,
>>>
>>> I'm using zookeeper route policy for leader selection on 8 instances
>>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>>> here?
>>>
>>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>>
>>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>>> policy.setShouldStopConsumer(false);
>>>
>>> from("cron").routePolicy(policy).log("started");
>>>
>>> Denny
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
>> To unsubscribe from Camel, click here.
>> NAML



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: zookeeper leader selection selects multiple leaders

Posted by Dennis Holunder <de...@gmail.com>.
Is there any documentation or example usage of zookeeper-master component?

2018-01-09 13:17 GMT+01:00 Claus Ibsen-2 [via Camel]
<ml...@n5.nabble.com>:
> Try the zookeeper-master component - it should be better
>
> On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <[hidden email]> wrote:
>
>> Hello,
>>
>> I'm using zookeeper route policy for leader selection on 8 instances
>> of my route and get sometimes 2 leaders selected. What I'm doing wrong
>> here?
>>
>> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>>
>> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
>> policy.setShouldStopConsumer(false);
>>
>> from("cron").routePolicy(policy).log("started");
>>
>> Denny
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/zookeeper-leader-selection-selects-multiple-leaders-tp5816553p5816554.html
> To unsubscribe from Camel, click here.
> NAML

Re: zookeeper leader selection selects multiple leaders

Posted by Claus Ibsen <cl...@gmail.com>.
Try the zookeeper-master component - it should be better

On Tue, Jan 9, 2018 at 12:55 PM, Dennis Holunder <de...@gmail.com> wrote:
> Hello,
>
> I'm using zookeeper route policy for leader selection on 8 instances
> of my route and get sometimes 2 leaders selected. What I'm doing wrong
> here?
>
> String uri = "zookeeper:srv1:2181,srv2:2181,srv3:2181/myapp/myroute";
>
> ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy(uri, 1);
> policy.setShouldStopConsumer(false);
>
> from("cron").routePolicy(policy).log("started");
>
> Denny



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2