Skip to content

Commit

Permalink
Merge 2d52b0c into backport/export-docs/willingly-amazed-sole
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-consul-core authored Aug 11, 2023
2 parents 447b369 + 2d52b0c commit 0b3abd8
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions website/content/commands/services/export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ description: |

Command: `consul services export`

The services export subcommand is used to export a service from one admin partition
or cluster peer to another. This is accomplished by creating or updating the corresponding
The `services export` command exports a service from one admin partition
or cluster peer to another. This command can be used in lieu of creating or updating the corresponding
`exported-services` configuration entry. Running the command multiple times with the same
arguments will result in a no-op.
arguments results in a no-op.

```text
Usage: consul services export [options] -name <service name> -consumer-peers <other cluster name>
Expand All @@ -28,38 +28,37 @@ Usage: consul services export [options] -name <service name> -consumer-peers <ot
Additional flags and more advanced use cases are detailed below.
```

#### Command Options
#### Command options

- `-name=<string>` - (Required) The name of the service to export.

- `-consumer-peers=<string>` - (Required) A comma-separated list of cluster peers to export the service to.
In Consul Enterprise, this flag is optional if -consumer-partitions is specified.
In Consul Enterprise, this flag is optional when `-consumer-partitions` is specified.

#### Enterprise Options
#### Enterprise options

- `-consumer-partitions=<string>` - A comma-separated list of admin partitions within the
same datacenter to export the service to. This flag is optional if -consumer-peers is specified.
same datacenter to export the service to. This flag is optional when `-consumer-peers` is specified.

@include 'http_api_partition_options.mdx'

@include 'http_api_namespace_options.mdx'

#### API Options
#### API options

@include 'http_api_options_client.mdx'

## Examples

The example below shows using the `export` command to export the `web` service to a cluster
peer named `dc2`.
In the following example, the `consul services export` command makes the `web` service available to services running in a cluster named `dc2` that has a previously-established cluster peering connection.

```shell-session hideClipboard
$ consul services export -name=web -consumer-peers=dc2
```

The example below shows using the `export` command to export the `web` service located in the
namespace `ns1` and the admin partition `part1` to other admin partitions named `part2` and `part3`.
In the following example, the `consul services export` command makes the `web` service located in the
namespace `ns1` and the admin partition `alpha` to other admin partitions named `beta` and `delta`.

```shell-session hideClipboard
$ consul services export -name=web -namespace=ns1 -partition=part1 -consumer-partitions=part2,part3
$ consul services export -name=web -namespace=ns1 -partition=alpha -consumer-partitions=beta,delta
```

0 comments on commit 0b3abd8

Please sign in to comment.