$res = $ua->get(‘http://localhost/v1/health/service/".$SRV.'?passing'); my $ref = JSON::XS::decode_json($res->content); my @list = sort { $a cmp $b } map { $_->{Node}{Address} } @$ref; my $ketama = Algorithm::ConsistentHash::Ketama->new(); $ketama->add_bucket($_ . '_' . $timestamp, 1) for @list; my $s1 = $ketama->hash($item_id); return 1 if $s1 eq $my_ip; my $s2 = $s1; while ($s2 eq $s1) { $s2 = $ketama->hash($item_id.’_'.$i); $i++; } return 1 if $s2 eq $my_ip; return; Get server list from Consul Make Consistent Hash Drawing by consistent-hashing Update Solr