Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Service

ChrisAubuchon edited this page Jul 14, 2015 · 4 revisions

service-deregister

API Reference

Remove a service from the agent

Basic Usage

Usage: consul-cli service-deregister [options] serviceId

Examples

$ ./consul-cli service-deregister test:test_service
$

service-maintenance

API Reference

Manage maintenance mode for a service

Basic Usage

Usage: consul-cli service-maintenance [options] serviceId

Command Line Options

  • --enabled
    When true, enable maintenance mode on the service. The default is true

  • --reason
    Optional text explaining the reason for putting the service in maintenance mode

Examples

$ ./consul-cli service-maintenance test:test_service
$ ./consul-cli health-service test_service
[
  {
  ...
      "Checks": [
      {
        "Node": "default",
        "CheckID": "_service_maintenance:test:test_service",
        "Name": "Service Maintenance Mode",
        "Status": "critical",
        "Notes": "Maintenance mode is enabled for this service, but no reason was provided. This is a default message.",
        "Output": "",
        "ServiceID": "test:test_service",
        "ServiceName": "test_service"
      },
    ]
  }
]
$ ./consul-cli service-maintenance --enabled=false test:test_service
$

service-register

API Reference

Register a new service with the agent

Basic Usage

Usage: consul-cli service-register [options] serviceName

Command Line Options

  • --id
    The id for the service. If this is not provided the serviceName is used. Duplicates IDs cannot exist on an agent so specifying an id may be required

  • --tag=<tagName>
    Tags to associate with the service. Multiple --tag options can be specified on the command line

  • --address=<address>
    Net address for the service

  • --port=<portNumber>
    Network port for the service

  • --check-http=<URL>
    Create an HTTP type check for the service. Only one of --check-http, --check-script or --check-ttl can be specified

  • --check-script=</path/to/script>
    Create a Script type check for the service. Only one of --check-http, --check-script or --check-ttl can be specified

  • --check-ttl=<duration>
    Create a TTL type check for the service. Only one of --check-http, --check-script or --check-ttl can be specified

  • --check-interval=<duration>
    Execution interval for HTTP and Script type checks

Examples

$ ./consul-cli service-register --id=test:test_service --tag=worker --tag=drone test_service
Clone this wiki locally