This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathreplication.http
169 lines (127 loc) · 4.07 KB
/
replication.http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!--
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
-->
### Setup remote connection with security plugin
PUT localhost:{{foll_port}}/_cluster/settings?pretty
Authorization: Basic admin admin
Content-Type: application/json
{
"persistent": {
"cluster": {
"remote": {
"source": {
"seeds": [ "127.0.0.1:9300" ]
}
}
}
}
}
### Add a document to leader with security plugin
PUT localhost:{{leader_port}}/customer/_doc/1?pretty
Authorization: Basic admin admin
Content-Type: application/json
{
"name": "John Doe"
}
### request with security plugin
PUT https://localhost:{{foll_port}}/_opendistro/_replication/customer/_start?pretty
Authorization: Basic admin admin
Content-Type: application/json
{
"remote_cluster": "remote-cluster",
"remote_index": "remote-index"
}
### Setup remote connection
PUT localhost:{{foll_port}}/_cluster/settings?pretty
Content-Type: application/json
{
"persistent": {
"cluster": {
"remote": {
"source": {
"seeds": [ "127.0.0.1:9300" ]
}
}
}
}
}
### Add a document to leader
PUT localhost:{{leader_port}}/customer/_doc/1?pretty
Content-Type: application/json
{
"name": "John Doe",
"age": 21
}
### Create empty index
PUT localhost:{{leader_port}}/customer
Content-Type: application/json
### flush index
POST localhost:{{leader_port}}/_flush
### Start replication
PUT localhost:{{foll_port}}/_opendistro/_replication/customer/_start
Content-Type: application/json
{
"remote_cluster" : "source",
"remote_index": "customer"
}
### Add another document after replication started
PUT localhost:{{leader_port}}/customer/_doc/2?pretty
Content-Type: application/json
{
"name": "Jane Doe"
}
### View leader data
GET localhost:{{leader_port}}/customer/_search?pretty&q=*:*&seq_no_primary_term=true
### View follower data all nodes
GET localhost:{{foll_port}}/customer/_search?pretty&q=*:*&seq_no_primary_term=true
### View follower data node-0
GET localhost:{{foll_port}}/customer/_search?pretty&q=*:*&seq_no_primary_term=true&preference=_only_nodes:node-0
### View follower data node-1
GET localhost:{{foll_port}}/customer/_search?pretty&q=*:*&seq_no_primary_term=true&preference=_only_nodes:node-1
### View follower data node-2
GET localhost:{{foll_port}}/customer/_search?pretty&q=*:*&seq_no_primary_term=true&preference=_only_nodes:node-2
### Show follower cluster nodes
GET localhost:{{foll_port}}/_cat/nodes?v&h=name,p,ip,po,m,node.role
### Show follower cluster shards
GET localhost:{{foll_port}}/_cat/shards?v
### Get leader retention lease info
GET localhost:{{leader_port}}/customer/_stats/docs?pretty&level=shards
### Show tasks
GET localhost:{{foll_port}}/_tasks?actions=*replication*&detailed
### Get follower metadata
GET localhost:{{foll_port}}/_cluster/state/metadata
### Leader shards info
GET localhost:{{leader_port}}/_cat/shards?v&h=i,s,pr,node,globalCheckpoint,maxSeqNo,segmentsCount,docs
### Follower shards info
GET localhost:{{foll_port}}/_cat/shards?v&h=i,s,pr,node,globalCheckpoint,maxSeqNo,segmentsCount,docs
### Update auto follow actions
POST localhost:{{foll_port}}/_opendistro/_replication/_autofollow
Content-Type: application/json
{
"connection": "source",
"name": "test",
"pattern": "*customer*"
}
### Delete the auto follow pattern
DELETE localhost:{{foll_port}}/_opendistro/_replication/_autofollow
Content-Type: application/json
{
"connection": "source",
"name": "test"
}
### Stop replication
POST localhost:{{foll_port}}/_opendistro/_replication/customer/_stop
Content-Type: application/json
{
}