mirror of
https://github.com/iSharkFly-Docs/opensearch-docs-cn
synced 2025-02-20 16:25:10 +00:00
First crack at CCR docs
This commit is contained in:
parent
b1d3a5906b
commit
5862b1b300
@ -45,6 +45,9 @@ collections:
|
||||
im-plugin:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
replication-plugin:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
monitoring-plugins:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
@ -81,6 +84,9 @@ just_the_docs:
|
||||
im-plugin:
|
||||
name: Index management plugin
|
||||
nav_fold: true
|
||||
replication-plugin:
|
||||
name: Replication plugin
|
||||
nav_fold: true
|
||||
monitoring-plugins:
|
||||
name: Monitoring plugins
|
||||
nav_fold: true
|
||||
|
243
_replication-plugin/api.md
Normal file
243
_replication-plugin/api.md
Normal file
@ -0,0 +1,243 @@
|
||||
---
|
||||
layout: default
|
||||
title: API
|
||||
nav_order: 50
|
||||
---
|
||||
|
||||
# Cross-cluster replication API
|
||||
|
||||
Use these replication operations to programmatically manage cross-cluster replication.
|
||||
|
||||
#### Table of contents
|
||||
- TOC
|
||||
{:toc}
|
||||
|
||||
## Start replication
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Initiate replication of an index from the leader cluster to the follower cluster. Run this operation on the follower cluster.
|
||||
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
PUT /_plugins/_replication/<follower-index>/_start
|
||||
{
|
||||
"leader_alias":"<leader-cluster-name>",
|
||||
"leader_index":"<index-name>",
|
||||
"use_roles":{
|
||||
"leader_cluster_role":"<role-name>",
|
||||
"follower_cluster_role":"<role-name>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Specify the following options:
|
||||
|
||||
Options | Description | Type | Required
|
||||
:--- | :--- |:--- |:--- |
|
||||
`leader_alias` | The name of the leader cluster. | `string` | Yes
|
||||
`leader_index` | The index on the leader cluster that you want to replicate. | `string` | Yes
|
||||
`use_roles` | The roles to use for all subsequent backend replication tasks between the indices. Specify a `leader_cluster_role` and `follower_cluster_role`. See [Map the leader and follower cluster roles]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#map-the-leader-and-follower-cluster-roles). | `string` | If security plugin is enabled
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
||||
|
||||
## Stop replication
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Terminates replication and converts the follower index to a standard index.
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
POST /_plugins/_replication/<follower-index>/_stop
|
||||
```
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
||||
|
||||
## Pause replication
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Pauses replication of the leader index. If you don't resume replication after 12 hours, it stops completely and the follower index is converted to a standard index.
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
PUT /_plugins/_replication/<follower-index>/_pause
|
||||
```
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
||||
|
||||
## Resume replication
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Resumes replication of the leader index.
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
PUT /_plugins/_replication/<follower-index>/_resume
|
||||
```
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
||||
|
||||
## Get replication status
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Gets the status of index replication. You can use this API to measure replication lag. Run this command from the leader cluster.
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
GET /_plugins/_replication/<follower-index>/_status
|
||||
```
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"status":"SYNCING",
|
||||
"reason":"User initiated",
|
||||
"remote_cluster":"remote-cluster",
|
||||
"leader_index":"leader-01",
|
||||
"follower_index":"follower-01",
|
||||
"syncing_details":{
|
||||
"remote_checkpoint": 19,
|
||||
"local_checkpoint": 19,
|
||||
"seq_no": 20
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To include shard replication details in the response, add `&verbose=true`.
|
||||
|
||||
## Update settings
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Updates settings on the follower index.
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
PUT /_plugins/_replication/<follower-index>/_update
|
||||
{
|
||||
"settings":{
|
||||
"index.number_of_shards": 4,
|
||||
"index.number_of_replicas": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
||||
|
||||
## Create replication rule
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Automatically starts replication on indices matching a specified pattern. Newly created indices on the remote cluster that match one of the specified patterns will be automatically configured as follower indices. You can also use this API to update existing auto-follow patterns.
|
||||
|
||||
Run this command on the follower cluster.
|
||||
|
||||
Make sure to note the names of all auto-follow patterns after you create them. The replication plugin currently does not include an API operation to retrieve a list of existing patterns.
|
||||
{: .tip }
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
POST /_plugins/_replication/_autofollow
|
||||
{
|
||||
"leader_alias" : "<leader-cluster-name>",
|
||||
"name": "<auto-follow-pattern-name>",
|
||||
"pattern": "<pattern>",
|
||||
"use_roles":{
|
||||
"leader_cluster_role": "<role-name>",
|
||||
"follower_cluster_role": "<role-name>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Specify the following options:
|
||||
|
||||
Options | Description | Type | Required
|
||||
:--- | :--- |:--- |:--- |
|
||||
`leader_alias` | The name of the remote cluster to associate the pattern with. | `string` | Yes
|
||||
`name` | A name for the auto-follow pattern. | `string` | Yes
|
||||
`pattern` | An array of index patterns to match against indices in the specified leader cluster. Supports wildcard characters. For example, `leader-*`. | `string` | Yes
|
||||
`use_roles` | The roles to use for all subsequent backend replication tasks between the indices. Specify a `leader_cluster_role` and `follower_cluster_role`. See [Map the leader and follower cluster roles]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#map-the-leader-and-follower-cluster-roles). | `string` | If security plugin is enabled
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
||||
|
||||
## Delete replication rule
|
||||
Introduced 1.1
|
||||
{: .label .label-purple }
|
||||
|
||||
Deletes the specified replication rule. This operation prevents any new indices from being replicated but does not stop existing replication that the rule has already initiated.
|
||||
|
||||
Run this command on the follower cluster.
|
||||
|
||||
#### Request
|
||||
|
||||
```json
|
||||
DELETE /_plugins/_replication/_autofollow
|
||||
{
|
||||
"leader_alias" : "<leader-cluster-name>",
|
||||
"name": "<auto-follow-pattern-name>",
|
||||
}
|
||||
```
|
||||
|
||||
Specify the following options:
|
||||
|
||||
Options | Description | Type | Required
|
||||
:--- | :--- |:--- |:--- |
|
||||
`leader_alias` | The name of the remote cluster that the pattern is associated with. | `string` | Yes
|
||||
`name` | The name of the pattern. | `string` | Yes
|
||||
|
||||
#### Sample response
|
||||
|
||||
```json
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
```
|
76
_replication-plugin/auto-follow.md
Normal file
76
_replication-plugin/auto-follow.md
Normal file
@ -0,0 +1,76 @@
|
||||
---
|
||||
layout: default
|
||||
title: Auto-follow
|
||||
nav_order: 20
|
||||
has_children: false
|
||||
|
||||
---
|
||||
|
||||
# Auto-follow for cross-cluster replication
|
||||
|
||||
Auto-follow lets you automatically replicate indices created on the leader cluster based on matching patterns. When you create an index on the leader cluster with a name that matches a specified pattern (for example, `index-01*`), a corresponding follower index is automatically created on the follower cluster.
|
||||
|
||||
You can configure multiple replication rules for a single cluster. The patterns currently only support wildcard matching.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You need to [set up a cross-cluster connection]({{site.url}}{{site.baseurl}}/replication-plugin/get-started/#set-up-a-cross-cluster-connection) between two clusters before you can enable auto-follow.
|
||||
|
||||
## Permissions
|
||||
|
||||
If the security plugin is enabled, non-admin users need to be mapped to the appropriate permissions in order to perform replication actions. For index and cluster-level permissions requirements, see [Cross-cluster replication permissions]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/).
|
||||
|
||||
## Get started with auto-follow
|
||||
|
||||
Replication rules are a collection of patterns that you create against a single remote cluster. When you create a replication rule, it automatically starts replicating any *new* indices that match the pattern, but does not replicate matching indices that were previously created.
|
||||
|
||||
Make sure to note the names of all rules when you create them. The replication plugin currently does not include an API operation to retrieve a list of existing rules.
|
||||
{: .tip }
|
||||
|
||||
Create a replication rule on the follower cluster:
|
||||
|
||||
```bash
|
||||
curl -XPOST -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/_autofollow?pretty' -d '
|
||||
{
|
||||
"leader_alias" : "leader-cluster",
|
||||
"name": "my-replication-rule",
|
||||
"pattern": "movies*",
|
||||
"use_roles":{
|
||||
"leader_cluster_role": "all_access",
|
||||
"follower_cluster_role": "all_access"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
If the security plugin is disabled, you can leave out the `use_roles` parameter. If it's enabled, however, you need to specify the leader and follower cluster roles that OpenSearch will use to authenticate the request. This example uses `all_access` for simplicity, but we recommend creating a replication user on each cluster and [mapping it accordingly]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#map-the-leader-and-follower-cluster-roles).
|
||||
{: .tip }
|
||||
|
||||
To test the rule, create a matching index on the leader cluster:
|
||||
|
||||
```bash
|
||||
curl -XPUT -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9201/movies-0001'
|
||||
```
|
||||
|
||||
And confirm its replica shows up on the follower cluster:
|
||||
|
||||
```bash
|
||||
curl -XGET -u 'admin:admin' -k 'https://localhost:9200/_cat/indices?v'
|
||||
```
|
||||
|
||||
```bash
|
||||
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
|
||||
yellow open movies-0001 kHOxYYHxRMeszLjTD9rvSQ 1 1 0 0 208b 208b
|
||||
```
|
||||
|
||||
## Delete a replication rule
|
||||
|
||||
When you delete a replication rule, OpenSearch stops replicating *new* indices that match the pattern, but replication of existing indices that the rule previously created will continue. If you need to stop existing replication activity, use the [stop replication API operation]({{site.url}}{{site.baseurl}}/replication-plugin/api/#stop-replication).
|
||||
|
||||
```bash
|
||||
curl -XDELETE -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/_autofollow?pretty' -d '
|
||||
{
|
||||
"leader_alias" : "leader-cluster",
|
||||
"name": "my-replication-rule"
|
||||
}'
|
||||
```
|
||||
|
271
_replication-plugin/get-started.md
Normal file
271
_replication-plugin/get-started.md
Normal file
@ -0,0 +1,271 @@
|
||||
---
|
||||
layout: default
|
||||
title: Get started
|
||||
nav_order: 10
|
||||
---
|
||||
|
||||
# Get started with cross-cluster replication
|
||||
|
||||
With cross-cluster replication, you index data to a leader index and that data is replicated to one or more read-only follower indices. All subsequnt operations on the leader are replicated on the follower, such as creating, updating, or deleting documents.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Cross-cluster replication has the following prerequisites:
|
||||
- Install the replication plugin on all nodes of both the leader and the follower cluster.
|
||||
- If you've overridden `node.roles` in opensearch.yml on the remote cluster, make sure it also includes the `remote_cluster_client` role:
|
||||
|
||||
```yaml
|
||||
node.roles: [<other_roles>, remote_cluster_client]
|
||||
```
|
||||
|
||||
## Permissions
|
||||
|
||||
Make sure the security plugin is either enabled on both clusters or disabled on both clusters. If you disabled the security plugin, you can skip this section.
|
||||
|
||||
If the security plugin is enabled, non-admin users need to be mapped to the appropriate permissions in order to perform replication actions. For index and cluster-level permissions requirements, see [Cross-cluster replication permissions]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/).
|
||||
|
||||
In addition, add the following setting to opensearch.yml on the leader cluster so it allows connections from the follower cluster:
|
||||
|
||||
```yml
|
||||
plugins.security.nodes_dn_dynamic_config_enabled: true
|
||||
```
|
||||
|
||||
## Example setup
|
||||
|
||||
Save this sample file as `docker-compose.yml` and run `docker-compose up` to start two single-node clusters on the same network:
|
||||
|
||||
```yml
|
||||
version: '3'
|
||||
services:
|
||||
replication-node1:
|
||||
image: opensearchproject/opensearch:{{site.opensearch_version}}
|
||||
container_name: replication-node1
|
||||
environment:
|
||||
- cluster.name=leader-cluster
|
||||
- discovery.type=single-node
|
||||
- bootstrap.memory_lock=true
|
||||
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
volumes:
|
||||
- opensearch-data2:/usr/share/opensearch/data
|
||||
ports:
|
||||
- 9201:9200
|
||||
- 9700:9600 # required for Performance Analyzer
|
||||
networks:
|
||||
- opensearch-net
|
||||
replication-node2:
|
||||
image: opensearchproject/opensearch:{{site.opensearch_version}}
|
||||
container_name: replication-node2
|
||||
environment:
|
||||
- cluster.name=follower-cluster
|
||||
- discovery.type=single-node
|
||||
- bootstrap.memory_lock=true
|
||||
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
volumes:
|
||||
- opensearch-data1:/usr/share/opensearch/data
|
||||
ports:
|
||||
- 9200:9200
|
||||
- 9600:9600 # required for Performance Analyzer
|
||||
networks:
|
||||
- opensearch-net
|
||||
|
||||
volumes:
|
||||
opensearch-data1:
|
||||
opensearch-data2:
|
||||
|
||||
networks:
|
||||
opensearch-net:
|
||||
```
|
||||
|
||||
After the clusters start, verify the names of each:
|
||||
|
||||
```bash
|
||||
curl -XGET -u 'admin:admin' -k 'https://localhost:9201'
|
||||
{
|
||||
"name" : "replication-node1",
|
||||
"cluster_name" : "leader-cluster",
|
||||
...
|
||||
}
|
||||
|
||||
curl -XGET -u 'admin:admin' -k 'https://localhost:9200'
|
||||
{
|
||||
"name" : "replication-node2",
|
||||
"cluster_name" : "follower-cluster",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
For this example, use port 9201 (`replication-node1`) as the leader and port 9200 (`replication-node2`) as the follower cluster.
|
||||
|
||||
To get the IP address for the leader cluster, first identify its container ID:
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
CONTAINER ID IMAGE PORTS NAMES
|
||||
3b8cdc698be5 opensearchproject/opensearch:{{site.opensearch_version}} 0.0.0.0:9200->9200/tcp, 0.0.0.0:9600->9600/tcp, 9300/tcp replication-node1
|
||||
731f5e8b0f4b opensearchproject/opensearch:{{site.opensearch_version}} 9300/tcp, 0.0.0.0:9201->9200/tcp, 0.0.0.0:9700->9600/tcp replication-node2
|
||||
```
|
||||
|
||||
Then get that container's IP address:
|
||||
|
||||
```bash
|
||||
docker inspect --format='{% raw %}{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}{% endraw %}' 731f5e8b0f4b
|
||||
172.22.0.3
|
||||
```
|
||||
|
||||
## Set up a cross-cluster connection
|
||||
|
||||
On the follower cluster, add the leader cluster name and the IP address (with port 9300) for each seed node. In this case, you only have one seed node:
|
||||
|
||||
```bash
|
||||
curl -XPUT -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_cluster/settings?pretty' -d '
|
||||
{
|
||||
"persistent": {
|
||||
"cluster": {
|
||||
"remote": {
|
||||
"leader-cluster": {
|
||||
"seeds": ["172.22.0.3:9300"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
## Start replication
|
||||
|
||||
To get started, create an index called `leader-01` on the remote (leader) cluster:
|
||||
|
||||
```bash
|
||||
curl -XPUT -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9201/leader-01?pretty'
|
||||
```
|
||||
|
||||
Start replication of that index from the follower cluster. Starting replication creates the provided follower index from scratch; you can't convert an existing index to a follower index.
|
||||
|
||||
Provide the leader cluster and index that you want to replicate:
|
||||
|
||||
```bash
|
||||
curl -XPUT -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_start?pretty' -d '
|
||||
{
|
||||
"leader_alias": "leader-cluster",
|
||||
"leader_index": "leader-01",
|
||||
"use_roles":{
|
||||
"leader_cluster_role": "all_access",
|
||||
"follower_cluster_role": "all_access"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
If the security plugin is disabled, you can leave out the `use_roles` parameter. If it's enabled, however, you need to specify the leader and follower cluster roles that OpenSearch will use to authenticate the request. This example uses `all_access` for simplicity, but we recommend creating a replication user on each cluster and [mapping it accordingly]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#map-the-leader-and-follower-cluster-roles).
|
||||
{: .tip }
|
||||
|
||||
This command creates an identical read-only index named "follower-01" on the local cluster that continuously stays updated with changes to the "leader-01" index on the remote cluster.
|
||||
|
||||
After replication starts, get the status:
|
||||
|
||||
```bash
|
||||
curl -XGET -k -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_status?pretty'
|
||||
|
||||
{
|
||||
"status" : "SYNCING",
|
||||
"reason" : "User initiated",
|
||||
"leader_alias" : "leader-cluster",
|
||||
"leader_index" : "leader-01",
|
||||
"follower_index" : "follower-01",
|
||||
"syncing_details" : {
|
||||
"leader_checkpoint" : -1,
|
||||
"follower_checkpoint" : -1,
|
||||
"seq_no" : 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Confirm replication
|
||||
|
||||
To confirm that replication is actually happening, add a document to the leader index:
|
||||
|
||||
```bash
|
||||
curl -XPUT -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9201/leader-01/_doc/1?pretty' -d '{"The Shining": "Stephen King"}'
|
||||
```
|
||||
|
||||
Then validate the replicated content on the follower index:
|
||||
|
||||
```bash
|
||||
curl -XGET -k -u 'admin:admin' 'https://localhost:9200/follower-01/_search?pretty'
|
||||
|
||||
{
|
||||
...
|
||||
"hits": [{
|
||||
"_index": "follower-01",
|
||||
"_type": "_doc",
|
||||
"_id": "1",
|
||||
"_score": 1.0,
|
||||
"_source": {
|
||||
"The Shining": "Stephen King"
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
## Pause and resume replication
|
||||
|
||||
You can temporarily pause replication of an index if you need to remediate issues or reduce load on the leader cluster:
|
||||
|
||||
```bash
|
||||
curl -XPOST -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_pause?pretty' -d '{}'
|
||||
```
|
||||
|
||||
To confirm replication is paused, get the status:
|
||||
|
||||
```bash
|
||||
curl -XGET -k -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_status?pretty'
|
||||
|
||||
{
|
||||
"status" : "PAUSED",
|
||||
"reason" : "User initiated",
|
||||
"leader_alias" : "leader-cluster",
|
||||
"leader_index" : "leader-01",
|
||||
"follower_index" : "follower-01"
|
||||
}
|
||||
```
|
||||
|
||||
When you're done making changes, resume replication:
|
||||
|
||||
```bash
|
||||
curl -XPOST -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_resume?pretty' -d '{}'
|
||||
```
|
||||
|
||||
When replication resumes, the follower index picks up any changes that were made to the leader index while replication was paused.
|
||||
|
||||
If you don't resume replication within 12 hours, replication stops completely and the follower index is converted to a standard index.
|
||||
|
||||
## Stop replication
|
||||
|
||||
Terminate replication of a specified index from the follower cluster:
|
||||
|
||||
```bash
|
||||
curl -XPOST -k -H 'Content-Type: application/json' -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_stop' -d '{}'
|
||||
```
|
||||
|
||||
When you stop replication, the follower index un-follows the leader and becomes a standard index that you can write to. You can't restart replication after it's been terminated.
|
||||
|
||||
Get the status to confirm that the index is no longer being replicated:
|
||||
|
||||
```bash
|
||||
curl -XGET -k -u 'admin:admin' 'https://localhost:9200/_plugins/_replication/follower-01/_status?pretty'
|
||||
|
||||
{
|
||||
"status" : "REPLICATION NOT IN PROGRESS"
|
||||
}
|
||||
```
|
||||
|
||||
You can further confirm that replication is stopped by making modifications to the leader index and confirming they don't show up on the follower index.
|
||||
|
||||
|
19
_replication-plugin/index.md
Normal file
19
_replication-plugin/index.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
layout: default
|
||||
title: Cross-cluster replication
|
||||
nav_order: 1
|
||||
has_children: false
|
||||
|
||||
---
|
||||
|
||||
# Cross-cluster replication
|
||||
|
||||
The cross-cluster replication plugin lets you replicate indices, mappings, and metadata from one OpenSearch cluster to another. It follows an active-passive replication model where the follower index (where the data is replicated) pulls data from the leader (source) index.
|
||||
|
||||
The replication plugin supports replication of indices using wildcard pattern matching and provides commands to pause, resume, and stop replication. Once replication starts on an index, it initiates a persistent background task on the primary shard of the follower cluster that continuously polls corresponding shards from the leader cluster for updates.
|
||||
|
||||
The replication plugin integrates with the security plugin so you can encrypt cross-cluster traffic with node-to-node encryption and control access to replication activities.
|
||||
|
||||
To start, see [Get started with cross-cluster replication]({{site.url}}{{site.baseurl}}/replication-plugin/get-started/).
|
||||
|
||||
|
78
_replication-plugin/permissions.md
Normal file
78
_replication-plugin/permissions.md
Normal file
@ -0,0 +1,78 @@
|
||||
---
|
||||
layout: default
|
||||
title: Permissions
|
||||
nav_order: 30
|
||||
---
|
||||
|
||||
# Cross-cluster replication permissions
|
||||
|
||||
You can use the [security plugin]({{site.url}}{{site.baseurl}}/security-plugin/index/) with cross-cluster replication to limit users to certain actions. For example, you might want certain users to only perform replication activity on the leader or follower cluster.
|
||||
|
||||
Because cross-cluster replication involves multiple clusters, it's possible that clusters might have different security configurations. The following configurations are supported:
|
||||
|
||||
- Security plugin fully enabled on both clusters
|
||||
- Security plugin enabled only for TLS on both clusters (`plugins.security.ssl_only`)
|
||||
- Security plugin absent or disabled on both clusters (not recommended)
|
||||
|
||||
You can enable node-to-node encryption on both the leader and the follower cluster to ensure that replication traffic between the clusters is encrypted.
|
||||
|
||||
## Basic permissions
|
||||
|
||||
In order for non-admin users to perform replication activities, they need to be mapped to the appropriate permissions.
|
||||
|
||||
The security plugin has two built-in roles that cover most replication use cases: `cross_cluster_replication_leader_full_access` which provides replication permissions on the leader cluster, and `cross_cluster_replication_follower_full_access` which provides replication permissions on the follower cluster. For descriptions of each, see [Predefined roles]({{site.url}}{{site.baseurl}}/security-plugin/access-control/users-roles#predefined-roles).
|
||||
|
||||
If you don't want to use the default roles, you can combine individual replication [permissions]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#replication-permissions) to meet your needs. Most permissions correspond to specific REST API operations. For example, the `indices:admin/plugins/replication/index/pause` permission lets you pause replication.
|
||||
|
||||
## Map the leader and follower cluster roles
|
||||
|
||||
The [start replication]({{site.url}}{{site.baseurl}}/replication-plugin/api/#start-replication) and [create replication rule]({{site.url}}{{site.baseurl}}/replication-plugin/api/#start-replication) are special cases because they involve background processes that require permissions on both the leader and the follower cluster. Therefore, when you perform one of these actions, you need to explicitly pass the `leader_cluster_role` and
|
||||
`follower_cluster_role` in the request, which OpenSearch will then use in all backend replication tasks.
|
||||
|
||||
To enable non-admins to start replication and create replication rules, create an identical user on each cluster (for example, `replication_user`) and map them to the `cross_cluster_replication_leader_full_access` role on the remote cluster and `cross_cluster_replication_follower_full_access` on the follower cluster. For instructions, see [Map users to roles]({{site.url}}{{site.baseurl}}/access-control/users-roles/#map-users-to-roles).
|
||||
|
||||
You can then pass those roles into the request along with the appropriate credentials:
|
||||
|
||||
```bash
|
||||
curl -XPUT -k -H 'Content-Type: application/json' -u 'replication_user:password' 'https://localhost:9200/_plugins/_replication/follower-01/_start?pretty' -d '
|
||||
{
|
||||
"leader_alias": "leader-cluster",
|
||||
"leader_index": "leader-01",
|
||||
"use_roles":{
|
||||
"leader_cluster_role": "cross_cluster_replication_leader_full_access",
|
||||
"follower_cluster_role": "cross_cluster_replication_follower_full_access"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
You can instead choose to create your own leader and follower cluster roles to meet your needs, but we recommend using the default roles.
|
||||
|
||||
## Replication permissions
|
||||
|
||||
The following sections list the available index and cluster-level permissions for cross-cluster replication.
|
||||
|
||||
### Follower cluster
|
||||
|
||||
Users can have the following permissions for the follower cluster:
|
||||
|
||||
```
|
||||
indices:admin/plugins/replication/index/setup/validate
|
||||
indices:admin/plugins/replication/index/start
|
||||
indices:admin/plugins/replication/index/pause
|
||||
indices:admin/plugins/replication/index/resume
|
||||
indices:admin/plugins/replication/index/stop
|
||||
indices:admin/plugins/replication/index/update
|
||||
indices:admin/plugins/replication/index/status_check
|
||||
indices:data/write/plugins/replication/changes
|
||||
cluster:admin/plugins/replication/autofollow/update
|
||||
```
|
||||
|
||||
### Leader cluster
|
||||
|
||||
Users can have the following permissions for the leader cluster:
|
||||
|
||||
```
|
||||
indices:admin/plugins/replication/validate
|
||||
indices:data/read/plugins/replication/file_chunk
|
||||
indices:data/read/plugins/replication/changes
|
||||
```
|
32
_replication-plugin/settings.md
Normal file
32
_replication-plugin/settings.md
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
layout: default
|
||||
title: Settings
|
||||
nav_order: 40
|
||||
---
|
||||
|
||||
# Replication settings
|
||||
|
||||
The replication plugin adds several settings to the standard OpenSearch cluster settings.
|
||||
The settings are dynamic, so you can change the default behavior of the plugin without restarting your cluster.
|
||||
You can mark settings as `persistent` or `transient`.
|
||||
|
||||
For example, to update the retention period of the result index:
|
||||
|
||||
```json
|
||||
PUT _cluster/settings
|
||||
{
|
||||
"persistent": {
|
||||
"plugins.replication.indices.recovery.parallel_chunks": "8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
These settings manage the resources consumed by remote recoveries. We don’t recommend changing these settings; the defaults should work well for most use cases.
|
||||
|
||||
Setting | Default | Description
|
||||
:--- | :--- | :---
|
||||
`plugins.replication.indices.recovery.chunk_size` | 1MB | The chunk size requested by the follower cluster during file transfer. Specify the chunk size as a value and unit, for example, 10MB, 5KB.
|
||||
`plugins.replication.indices.recovery.parallel_chunks` | 5 | The number of file chunk requests that can be sent in parallel for each recovery.
|
||||
`plugins.replication.indices.recovery.request_timeout` | 60s | The amount of time to wait for individual network requests during the remote recovery process. A single action timeout can cause recovery to fail.
|
||||
`plugins.replication.indices.recovery.activity_timeout` | 5m | The amount of time to wait for recovery activity. If the leader cluster doesn't receive recovery requests from the follower for this amount of time, it closes the in-memory resources needed to supply data to the follower during recovery.
|
||||
|
@ -59,6 +59,7 @@ Rather than creating new action groups from individual permissions, you can ofte
|
||||
- cluster:admin/opensearch/reports/instance/get
|
||||
- cluster:admin/opensearch/reports/instance/list
|
||||
- cluster:admin/opensearch/reports/menu/download
|
||||
- cluster:admin/plugins/replication/autofollow/update
|
||||
- cluster:admin/reindex/rethrottle
|
||||
- cluster:admin/repository/delete
|
||||
- cluster:admin/repository/get
|
||||
@ -114,6 +115,13 @@ Rather than creating new action groups from individual permissions, you can ofte
|
||||
- indices:admin/mappings/fields/get*
|
||||
- indices:admin/mappings/get
|
||||
- indices:admin/open
|
||||
- indices:admin/plugins/replication/index/setup/validate
|
||||
- indices:admin/plugins/replication/index/start
|
||||
- indices:admin/plugins/replication/index/pause
|
||||
- indices:admin/plugins/replication/index/resume
|
||||
- indices:admin/plugins/replication/index/stop
|
||||
- indices:admin/plugins/replication/index/update
|
||||
- indices:admin/plugins/replication/index/status_check
|
||||
- indices:admin/refresh
|
||||
- indices:admin/refresh*
|
||||
- indices:admin/resolve/index
|
||||
@ -139,6 +147,8 @@ Rather than creating new action groups from individual permissions, you can ofte
|
||||
- indices:data/read/msearch/template
|
||||
- indices:data/read/mtv
|
||||
- indices:data/read/mtv*
|
||||
- indices:data/read/plugins/replication/file_chunk
|
||||
- indices:data/read/plugins/replication/changes
|
||||
- indices:data/read/scroll
|
||||
- indices:data/read/scroll/clear
|
||||
- indices:data/read/search
|
||||
@ -150,6 +160,7 @@ Rather than creating new action groups from individual permissions, you can ofte
|
||||
- indices:data/write/delete
|
||||
- indices:data/write/delete/byquery
|
||||
- indices:data/write/index
|
||||
- indices:data/write/plugins/replication/changes
|
||||
- indices:data/write/reindex
|
||||
- indices:data/write/update
|
||||
- indices:data/write/update/byquery
|
||||
|
@ -109,6 +109,8 @@ Role | Description
|
||||
`anomaly_full_access` | Grants full permissions to all anomaly detection actions.
|
||||
`anomaly_read_access` | Grants permissions to view detectors, but not create, modify, or delete detectors.
|
||||
`all_access` | Grants full access to the cluster: all cluster-wide operations, write to all indices, write to all tenants.
|
||||
`cross_cluster_replication_follower_full_access` | Grants full access to perform cross-cluster replication actions on the follower cluster.
|
||||
`cross_cluster_replication_leader_full_access` | Grants full access to perform cross-cluster replication actions on the leader cluster.
|
||||
`kibana_read_only` | A special role that prevents users from making changes to visualizations, dashboards, and other OpenSearch Dashboards objects. See `plugins.security.readonly_mode.roles` in `opensearch_dashboards.yml`. Pair with the `kibana_user` role.
|
||||
`kibana_user` | Grants permissions to use OpenSearch Dashboards: cluster-wide searches, index monitoring, and write to various OpenSearch Dashboards indices.
|
||||
`logstash` | Grants permissions for Logstash to interact with the cluster: cluster-wide searches, cluster monitoring, and write to the various Logstash indices.
|
||||
|
Loading…
x
Reference in New Issue
Block a user