logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Search::Elasticsearch::CxnPool::Sniff - A CxnPool for connecting to a local cluster with a dynamic node

Author

       Enrico Zimuel <enrico.zimuel@elastic.co>

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.

   Seealso
       •   "request_timeout" in Search::Elasticsearch::Role::Cxn

       •   "sniff_timeout" in Search::Elasticsearch::Role::Cxn

       •   "sniff_request_timeout" in Search::Elasticsearch::Role::Cxn

   Inheritedconfiguration
       From Search::Elasticsearch::Role::CxnPool::Sniff

       •   sniff_interval

       •   sniff_max_content_length

       From Search::Elasticsearch::Role::CxnPool

       •   randomize_cxns

Description

       The Sniff connection pool should be used when you do have direct access to the Elasticsearch cluster, eg
       when your web servers and Elasticsearch servers are on the same network.  The nodes that you specify are
       used to discover the cluster, which is then sniffed to find the current list of live nodes that the
       cluster knows about.

       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 will be auto-discovered during a sniff.

       If all sniffed nodes fail, then it falls back to sniffing the original seed nodes that you specified in
       new().

       For HTTP Cxn classes, this module will also dynamically detect the "max_content_length" which the nodes
       in the cluster will accept.

       This class does Search::Elasticsearch::Role::CxnPool::Sniff and Search::Elasticsearch::Role::Is_Sync.

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.

   schedule_check()
           $cxn_pool->schedule_check

       Forces a sniff before the next Cxn is returned, to updated the list of healthy nodes in the cluster.

   sniff()
           $bool = $cxn_pool->sniff

       Sniffs the cluster and returns "true" if the sniff was successful.

   Inheritedmethods
       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()

Name

       Search::Elasticsearch::CxnPool::Sniff - A CxnPool for connecting to a local cluster with a dynamic node
       list

Synopsis

           $e = Search::Elasticsearch->new(
               cxn_pool => 'Sniff',
               nodes    => [
                   'search1:9200',
                   'search2:9200'
               ],
           );

Version

       version 8.12

See Also