You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
- 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 removeand:
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`:
230
230
231
231
```sql
232
-
SELECT DISTINCT replica_name
232
+
SELECT DISTINCT arrayJoin(mapKeys(replica_is_active)) AS replica_name
233
233
FROM system.replicas
234
234
235
235
┌─replica_name─┐
@@ -240,37 +240,38 @@ FROM system.replicas
240
240
└──────────────┘
241
241
```
242
242
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:
244
244
245
245
```sql
246
-
SYSTEM DROP REPLICA 'arg_t01'
246
+
SYSTEM DROP REPLICA 'arg_t04'
247
247
```
248
248
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
250
251
251
252
```sql
252
253
-- 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'
254
255
255
256
Elapsed: 0.017 sec.
256
257
257
258
Received exception from server (version 23.8.6):
258
259
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)
259
260
```
260
261
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:
262
263
263
264
```sql
264
-
SELECT DISTINCT replica_name
265
+
SELECT DISTINCT arrayJoin(mapKeys(replica_is_active)) AS replica_name
265
266
FROM system.replicas
266
267
267
268
┌─replica_name─┐
269
+
│ arg_t01 │
268
270
│ arg_t02 │
269
271
│ arg_t03 │
270
-
│ arg_t04 │
271
272
└──────────────┘
272
273
273
-
-- We should see there is no replica arg_t01
274
+
-- We should see there is no replica arg_t04
274
275
```
275
276
276
277
-Delete the replica in the cluster configuration: `remote_servers.xml`and shutdown the node/replica removed.
0 commit comments