Skip to content

Commit fbf2c73

Browse files
authored
Clarify instructions for removing cluster replicas
Updated instructions for removing replicas from a cluster, including clarifications on connecting to the correct replica and the implications of using SYSTEM DROP REPLICA.
1 parent a49409e commit fbf2c73

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

content/en/altinity-kb-setup-and-maintenance/altinity-kb-data-migration/add_remove_replica.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ Query id: 992cae2a-fb58-4150-a088-83273805d0c4
226226

227227
## REMOVE nodes/Replicas from a Cluster
228228

229-
- It is important to know which replica/node you want to remove to avoid problems. To check it you need to connect to the replica/node you want to remove and:
229+
- It is important to know which replica/node you want to remove to avoid problems. To check it you need to connect to a different replica/node that the one you want to remove. For instance we want to remove `arg_t04`, so we connected to replica `arg_t01`:
230230

231231
```sql
232-
SELECT DISTINCT replica_name
232+
SELECT DISTINCT arrayJoin(mapKeys(replica_is_active)) AS replica_name
233233
FROM system.replicas
234234
235235
┌─replica_name─┐
@@ -240,37 +240,38 @@ FROM system.replicas
240240
└──────────────┘
241241
```
242242

243-
- After that we need connect to a replica different from the one that we want to remove (arg_tg01) and execute:
243+
- After that (make sure you're connected to a replica different from the one that you want to remove, `arg_tg01`) and execute:
244244
245245
```sql
246-
SYSTEM DROP REPLICA 'arg_t01'
246+
SYSTEM DROP REPLICA 'arg_t04'
247247
```
248248
249-
- This cannot be executed on the replica we want to remove (drop local replica), please use **`DROP TABLE/DATABASE`** for that. **`DROP REPLICA`** does not drop any tables and does not remove any data or metadata from disk:
249+
- If by any chance you're connected to the same replica you want to remove then **`SYSTEM DROP REPLICA`** will not work.
250+
- BTW `SYSTEM DROP REPLICA` does not drop any tables and does not remove any data or metadata from disk, it will only remove metadata from Zookeeper/Keeper
250251

251252
```sql
252253
-- What happens if executing system drop replica in the local replica to remove.
253-
SYSTEM DROP REPLICA 'arg_t01'
254+
SYSTEM DROP REPLICA 'arg_t04'
254255
255256
Elapsed: 0.017 sec.
256257
257258
Received exception from server (version 23.8.6):
258259
Code: 305. DB::Exception: Received from dnieto-zenbook.lan:9440. DB::Exception: We can't drop local replica, please use `DROP TABLE` if you want to clean the data and drop this replica. (TABLE_WAS_NOT_DROPPED)
259260
```
260261

261-
- After DROP REPLICA, we need to check that the replica is gone from the list or replicas. Connect to a node and execute:
262+
- After DROP REPLICA, we need to check that the replica is gone from the list or replicas:
262263

263264
```sql
264-
SELECT DISTINCT replica_name
265+
SELECT DISTINCT arrayJoin(mapKeys(replica_is_active)) AS replica_name
265266
FROM system.replicas
266267
267268
┌─replica_name─┐
269+
│ arg_t01 │
268270
│ arg_t02 │
269271
│ arg_t03 │
270-
│ arg_t04 │
271272
└──────────────┘
272273
273-
-- We should see there is no replica arg_t01
274+
-- We should see there is no replica arg_t04
274275
```
275276

276277
- Delete the replica in the cluster configuration: `remote_servers.xml` and shutdown the node/replica removed.

0 commit comments

Comments
 (0)