| 1 | # Licensed to Elasticsearch B.V under one or more agreements. | ||
| 2 | # Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
| 3 | # See the LICENSE file in the project root for more information | ||
| 4 | |||
| 5 | package Search::Elasticsearch::CxnPool::Static::NoPing; | ||
| 6 | 7 | $Search::Elasticsearch::CxnPool::Static::NoPing::VERSION = '7.30_1'; # TRIAL | |
| 7 | |||
| 8 | 7 | $Search::Elasticsearch::CxnPool::Static::NoPing::VERSION = '7.301'; | |
| 9 | 7 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 7 | with 'Search::Elasticsearch::Role::CxnPool::Static::NoPing', | |
| 11 | 'Search::Elasticsearch::Role::Is_Sync'; | ||
| 12 | 7 | ▶ | use Search::Elasticsearch::Util qw(throw); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 7 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 7 | 1; | |
| 16 | |||
| 17 | =pod | ||
| 18 | |||
| 19 | =encoding UTF-8 | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | Search::Elasticsearch::CxnPool::Static::NoPing - A CxnPool for connecting to a remote cluster without the ability to ping. | ||
| 24 | |||
| 25 | =head1 VERSION | ||
| 26 | |||
| 27 | version 7.30_1 | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | $e = Search::Elasticsearch->new( | ||
| 32 | cxn_pool => 'Static::NoPing' | ||
| 33 | nodes => [ | ||
| 34 | 'search1:9200', | ||
| 35 | 'search2:9200' | ||
| 36 | ], | ||
| 37 | ); | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | The L<Static::NoPing|Search::Elasticsearch::CxnPool::Static::NoPing> connection | ||
| 42 | pool (like the L<Static|Search::Elasticsearch::CxnPool::Static> pool) should be used | ||
| 43 | when your access to the cluster is limited. However, the C<Static> pool needs | ||
| 44 | to be able to ping nodes in the cluster, with a C<HEAD /> request. If you | ||
| 45 | can't ping your nodes, then you should use the C<Static::NoPing> | ||
| 46 | connection pool instead. | ||
| 47 | |||
| 48 | Because the cluster cannot be pinged, this CxnPool cannot use a short | ||
| 49 | ping request to determine whether nodes are live or not - it just has to | ||
| 50 | send requests to the nodes to determine whether they are alive or not. | ||
| 51 | |||
| 52 | Most of the time, a dead node will cause the request to fail quickly. | ||
| 53 | However, in situations where node failure takes time (eg malfunctioning | ||
| 54 | routers or firewalls), a failure may not be reported until the request | ||
| 55 | itself times out (see L<Search::Elasticsearch::Cxn/request_timeout>). | ||
| 56 | |||
| 57 | Failed nodes will be retried regularly to check if they have recovered. | ||
| 58 | |||
| 59 | This class does L<Search::Elasticsearch::Role::CxnPool::Static::NoPing> and | ||
| 60 | L<Search::Elasticsearch::Role::Is_Sync>. | ||
| 61 | |||
| 62 | =head1 CONFIGURATION | ||
| 63 | |||
| 64 | =head2 C<nodes> | ||
| 65 | |||
| 66 | The list of nodes to use to serve requests. Can accept a single node, | ||
| 67 | multiple nodes, and defaults to C<localhost:9200> if no C<nodes> are | ||
| 68 | specified. See L<Search::Elasticsearch::Role::Cxn/node> for details of the node | ||
| 69 | specification. | ||
| 70 | |||
| 71 | =head2 See also | ||
| 72 | |||
| 73 | =over | ||
| 74 | |||
| 75 | =item * | ||
| 76 | |||
| 77 | L<Search::Elasticsearch::Role::Cxn/request_timeout> | ||
| 78 | |||
| 79 | =item * | ||
| 80 | |||
| 81 | L<Search::Elasticsearch::Role::Cxn/dead_timeout> | ||
| 82 | |||
| 83 | =item * | ||
| 84 | |||
| 85 | L<Search::Elasticsearch::Role::Cxn/max_dead_timeout> | ||
| 86 | |||
| 87 | =back | ||
| 88 | |||
| 89 | =head2 Inherited configuration | ||
| 90 | |||
| 91 | From L<Search::Elasticsearch::Role::CxnPool::Static::NoPing> | ||
| 92 | |||
| 93 | =over | ||
| 94 | |||
| 95 | =item * L<max_retries|Search::Elasticsearch::Role::CxnPool::Static::NoPing/"max_retries"> | ||
| 96 | |||
| 97 | =back | ||
| 98 | |||
| 99 | From L<Search::Elasticsearch::Role::CxnPool> | ||
| 100 | |||
| 101 | =over | ||
| 102 | |||
| 103 | =item * L<randomize_cxns|Search::Elasticsearch::Role::CxnPool/"randomize_cxns"> | ||
| 104 | |||
| 105 | =back | ||
| 106 | |||
| 107 | =head1 METHODS | ||
| 108 | |||
| 109 | =head2 C<next_cxn()> | ||
| 110 | |||
| 111 | $cxn = $cxn_pool->next_cxn | ||
| 112 | |||
| 113 | Returns the next available node in round robin fashion - either a live node | ||
| 114 | which has previously responded successfully, or a previously failed | ||
| 115 | node which should be retried. If all nodes are dead, it will throw | ||
| 116 | a C<NoNodes> error. | ||
| 117 | |||
| 118 | =head2 Inherited methods | ||
| 119 | |||
| 120 | From L<Search::Elasticsearch::Role::CxnPool::Static::NoPing> | ||
| 121 | |||
| 122 | =over | ||
| 123 | |||
| 124 | =item * L<should_mark_dead()|Search::Elasticsearch::Role::CxnPool::Static::NoPing/"should_mark_dead()"> | ||
| 125 | |||
| 126 | =item * L<schedule_check()|Search::Elasticsearch::Role::CxnPool::Static::NoPing/"schedule_check()"> | ||
| 127 | |||
| 128 | =back | ||
| 129 | |||
| 130 | From L<Search::Elasticsearch::Role::CxnPool> | ||
| 131 | |||
| 132 | =over | ||
| 133 | |||
| 134 | =item * L<cxn_factory()|Search::Elasticsearch::Role::CxnPool/"cxn_factory()"> | ||
| 135 | |||
| 136 | =item * L<logger()|Search::Elasticsearch::Role::CxnPool/"logger()"> | ||
| 137 | |||
| 138 | =item * L<serializer()|Search::Elasticsearch::Role::CxnPool/"serializer()"> | ||
| 139 | |||
| 140 | =item * L<current_cxn_num()|Search::Elasticsearch::Role::CxnPool/"current_cxn_num()"> | ||
| 141 | |||
| 142 | =item * L<cxns()|Search::Elasticsearch::Role::CxnPool/"cxns()"> | ||
| 143 | |||
| 144 | =item * L<seed_nodes()|Search::Elasticsearch::Role::CxnPool/"seed_nodes()"> | ||
| 145 | |||
| 146 | =item * L<next_cxn_num()|Search::Elasticsearch::Role::CxnPool/"next_cxn_num()"> | ||
| 147 | |||
| 148 | =item * L<set_cxns()|Search::Elasticsearch::Role::CxnPool/"set_cxns()"> | ||
| 149 | |||
| 150 | =item * L<request_ok()|Search::Elasticsearch::Role::CxnPool/"request_ok()"> | ||
| 151 | |||
| 152 | =item * L<request_failed()|Search::Elasticsearch::Role::CxnPool/"request_failed()"> | ||
| 153 | |||
| 154 | =item * L<should_retry()|Search::Elasticsearch::Role::CxnPool/"should_retry()"> | ||
| 155 | |||
| 156 | =item * L<should_mark_dead()|Search::Elasticsearch::Role::CxnPool/"should_mark_dead()"> | ||
| 157 | |||
| 158 | =item * L<cxns_str()|Search::Elasticsearch::Role::CxnPool/"cxns_str()"> | ||
| 159 | |||
| 160 | =item * L<cxns_seeds_str()|Search::Elasticsearch::Role::CxnPool/"cxns_seeds_str()"> | ||
| 161 | |||
| 162 | =item * L<retries()|Search::Elasticsearch::Role::CxnPool/"retries()"> | ||
| 163 | |||
| 164 | =item * L<reset_retries()|Search::Elasticsearch::Role::CxnPool/"reset_retries()"> | ||
| 165 | |||
| 166 | =back | ||
| 167 | |||
| 168 | =head1 AUTHOR | ||
| 169 | |||
| 170 | Enrico Zimuel <enrico.zimuel@elastic.co> | ||
| 171 | |||
| 172 | =head1 COPYRIGHT AND LICENSE | ||
| 173 | |||
| 174 | This software is Copyright (c) 2020 by Elasticsearch BV. | ||
| 175 | |||
| 176 | This is free software, licensed under: | ||
| 177 | |||
| 178 | The Apache License, Version 2.0, January 2004 | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | __END__ | ||