-
Notifications
You must be signed in to change notification settings - Fork 60
/
replication.http
183 lines (139 loc) · 4.18 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!--
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
-->
### 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}}/_plugins/_replication/customer/_start?pretty
Authorization: Basic admin admin
Content-Type: application/json
{
"leader_alias": "remote-cluster",
"leader_index": "leader-index",
"assume_roles": {
"leader_cluster_role": "all_access",
"follower_cluster_role": "all_access"
}
}
### 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}}/_plugins/_replication/customer/_start
Content-Type: application/json
{
"leader_alias" : "source",
"leader_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}}/_plugins/_replication/_autofollow
Content-Type: application/json
{
"leader_alias": "source",
"name": "test",
"pattern": "*customer*"
}
### Add auto follow actions with Security plugin
POST localhost:{{foll_port}}/_plugins/_replication/_autofollow
Content-Type: application/json
{
"leader_alias": "source",
"name": "test",
"pattern": "*customer*",
"assume_roles": {
"leader_cluster_role": "all_access",
"follower_cluster_role": "all_access"
}
}
### Delete the auto follow pattern
DELETE localhost:{{foll_port}}/_plugins/_replication/_autofollow
Content-Type: application/json
{
"leader_alias": "source",
"name": "test"
}
### Stop replication
POST localhost:{{foll_port}}/_plugins/_replication/customer/_stop
Content-Type: application/json
{
}