Search...::Sniff(3pm)
π NAME π
okay bestie, say hi to Search::Elasticsearch::CxnPool::Sniff β a CxnPool for connecting to a local cluster with a dynamic node list. yes, dynamic. the node list updates itself. main character energy fr fr β¨
(and just so we're clear, you're reading the Search...::Sniff(3pm) page from the user contributed Perl documentation. hi. welcome. π«Ά)
π VERSION π
version 8.12. she's on 8.12, no cap.
πΈ SYNOPSIS πΈ
$e = Search::Elasticsearch->new(
cxn_pool => 'Sniff',
nodes => [
'search1:9200',
'search2:9200'
],
);
π DESCRIPTION π
so the Sniff connection pool is the one to use when you actually have direct access to the Elasticsearch cluster β like, when your web servers and your Elasticsearch servers are literally on the same network π«Ά. the nodes you specify are just there to discover the cluster, and then the cluster gets sniffed to find the current list of live nodes that it knows about. it's giving "I know a guy who knows a guy" but for nodes.
this sniff process is repeated regularly, or whenever a node fails, to update the list of healthy nodes. so if you add more nodes to your cluster, they get auto-discovered during a sniff. auto-discovery?? we love her, that's iconic π
if all sniffed nodes fail, then it falls back to sniffing the original seed nodes that you specified in new(). safety net behaviour, bestie. she will not leave you stranded π
for HTTP Cxn classes, this module will also dynamically detect the "max_content_length" which the nodes in the cluster will accept. yes, it just figures that out on its own. obsessed.
this class does Search::Elasticsearch::Role::CxnPool::Sniff and Search::Elasticsearch::Role::Is_Sync. it does both. it's doing both. periodt. π
βοΈ CONFIGURATION βοΈ
π§΅ "nodes"
the list of nodes to use to discover the cluster. can accept a single node, multiple nodes, and defaults to "localhost:9200" if no "nodes" are specified. see "node" in Search::Elasticsearch::Role::Cxn for details of the node specification. so basically: don't stress, there's a default, but also read the docs for the fancy spec stuff π
π See also
"request_timeout"in Search::Elasticsearch::Role::Cxn"sniff_timeout"in Search::Elasticsearch::Role::Cxn"sniff_request_timeout"in Search::Elasticsearch::Role::Cxn
𧬠Inherited configuration
from Search::Elasticsearch::Role::CxnPool::Sniff:
sniff_intervalsniff_max_content_length
from Search::Elasticsearch::Role::CxnPool:
randomize_cxns
π οΈ METHODS π οΈ
π next_cxn()
$cxn = $cxn_pool->next_cxn
returns the next available live node (in round robin fashion π ), or throws a "NoNodes" error if no nodes can be sniffed from the cluster. so like, if there's genuinely nobody home, she's gonna tell you. loudly. that's an error, not a vibe.
π schedule_check()
$cxn_pool->schedule_check
forces a sniff before the next Cxn is returned, to update the list of healthy nodes in the cluster. a little "hey, refresh urself before you hand me anything" nudge π
π sniff()
$bool = $cxn_pool->sniff
sniffs the cluster and returns "true" if the sniff was successful. that's it. that's the method. slay.
𧬠Inherited methods
from Search::Elasticsearch::Role::CxnPool::Sniff:
schedule_check()parse_sniff()should_accept_node()
from Search::Elasticsearch::Role::CxnPool:
cxn_factory()logger()serializer()current_cxn_num()cxns()seed_nodes()next_cxn_num()set_cxns()request_ok()request_failed()should_retry()should_mark_dead()cxns_str()cxns_seeds_str()retries()reset_retries()
βοΈ AUTHOR βοΈ
Enrico Zimuel <enrico.zimuel@elastic.co> β ty for your service king π
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2024 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
okay that's the whole page bestie, go forth and sniff responsibly π
and a lil sign-off, because the fine print at the bottom said so: this page is perl v5.38.2, dated 2024-02-04, and it's still Search...::Sniff(3pm). bye bestie, drink water, read your logs π¦π
π¦ where this page comes from
- debian trixie: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu noble: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu resolute: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu stonking: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms