Search...::Sniff(3pm)
π Search::Elasticsearch::Role::CxnPool::Sniff π
okay bestie so this is a role from the User Contributed Perl Documentation corner of the world, and it's literally the CxnPool role that lets you connect to a local cluster with a dynamic node list. sniff sniff, we're detecting nodes out here π¦
β¨ VERSION β¨
version 8.12 β periodt, that's the one.
π CONFIGURATION π
πΈ sniff_interval
How often are we gonna do a lil sniff to clock whether new nodes have joined the cluster? Defaults to 300 seconds. So every five minutes we're peeking π
πΈ sniff_max_content_length
Should we set max_content_length dynamically while sniffing, yes or yes? Defaults to true, unless a fixed max_content_length was specified β then we respect that, no cap.
π METHODS π
π
schedule_check()
$cxn_pool->schedule_check
Schedules a sniff before the next request gets processed. So the vibe check happens before we go anywhere, iconic behaviour fr fr.
π
parse_sniff()
$bool = $cxn_pool->parse_sniff(\%nodes);
This one parses the response from a sniff request and pulls out the hostname/ip of every single listed node, filtered through should_accept_node(). If any live nodes show up, they get passed along to set_cxns() in Search::Elasticsearch::Role::CxnPool. Oh and the max_content_length is also detected if sniff_max_content_length is true. multi-tasking queen π
π
should_accept_node()
$host = $cxn_pool->should_accept_node($host,$node_id,\%node_data)
This method is a hook β meaning you, yes YOU, can override it. When a sniff happens, this gets called with the host (eg 192.168.5.100:9200), the node_id (the ID Elasticsearch assigned to that node) and the node_data, which holds all the info about the node that Elasticsearch sent back, eg:
{
"transport_address" => "inet[192.168.5.100/192.168.5.100:9300]",
"http" : {
"publish_address" => "inet[/192.168.5.100:9200]",
"max_content_length" => "100mb",
"bound_address" => "inet[/0:0:0:0:0:0:0:0:9200]",
"max_content_length_in_bytes" : 104857600
},
"version" => "0.90.4",
"name" => "Silver Sable",
"hostname" => "search1.domain.com",
"http_address" => "inet[/192.168.5.100:9200]"
}
If the node should be accepted (aka used to serve data, main character energy), then return the host value you wanna use. By default? nodes are always accepted. generous queen π«Ά
π AUTHOR π
Enrico Zimuel <enrico.zimuel@elastic.co>
π 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
and that's the whole page bestie, no crumbs left behind π
kisses, this was brought to you by perl v5.38.2, dated 2024-02-04 β Search...::Sniff(3pm) signing off, mwah πβ¨
π¦ 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