github.com/KyaXTeam/consul@v1.4.5/website/source/docs/commands/maint.html.markdown.erb (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Commands: Maint"
     4  sidebar_current: "docs-commands-maint"
     5  description: >
     6    The `maint` command provides control of both service and node maintenance mode
     7  ---
     8  
     9  # Consul Maint
    10  
    11  Command: `consul maint`
    12  
    13  The `maint` command provides control of service maintenance mode.
    14  Using the command, it is possible to mark a service provided by a node or all the services on the
    15  node as a whole as "under maintenance". In this mode of operation, the service
    16   will not appear in DNS query results, or API results. This effectively
    17  takes the service out of the pool of available "healthy" nodes of a service.
    18  
    19  Under the hood, maintenance mode is activated by registering a health check in
    20  critical status against a service, and deactivated by deregistering the
    21  health check.
    22  
    23  ## Usage
    24  
    25  Usage: `consul maint [options]`
    26  
    27  #### API Options
    28  
    29  <%= partial "docs/commands/http_api_options_client" %>
    30  
    31  #### Command Options
    32  
    33  * `-enable` - Enable maintenance mode on all services on a node. If
    34    combined with the `-service` flag, we operate on a specific service ID.
    35  
    36  * `-disable` - Disable maintenance mode on all services on a node. If
    37    combined with the `-service` flag, we operate on a specific service ID.
    38  
    39  * `-reason` - An optional reason for placing the service into
    40    maintenance mode. If provided, this reason will be visible in the newly-
    41    registered critical check's "Notes" field.
    42  
    43  * `-service` - An optional service ID to control maintenance mode for a given service. By
    44    providing this flag, the `-enable` and `-disable` flags functionality is
    45    modified to operate on the given service ID.
    46  
    47  ## List mode
    48  
    49  If neither `-enable` nor `-disable` are passed, the `maint` command will
    50  switch to "list mode", displaying any current maintenances. This may return
    51  blank if nothing is currently under maintenance. The output will look like:
    52  
    53  ```
    54  $ consul maint
    55  Node:
    56    Name:   node1.local
    57    Reason: This node is broken.
    58  
    59  Service:
    60    ID:     redis
    61    Reason: Redis is currently offline.
    62  ```