How to change IP-address of a gluster brick
- Details
- Category: Blog
- Published: Monday, 22 November 2021 09:35
- Written by Lars Berntzon
- Hits: 2772
I wrote this small script to replace the IP-address of a brick of a gluster volume. This can for instance be needed when new network interfaces are added or changed on a gluster node:
#!/bin/bash
if [ $# != 4 ]; then
echo "Usage: switch-brick volume old-host new-host path-on-server" >&2
exit 1
fi
VOLUME="$1"
OLD_HOST="$2"
NEW_HOST="$3"
DISK_PATH="$4"
$DRYRUN gluster volume reset-brick "$VOLUME" "$OLD_HOST":"$DISK_PATH" start &&
$DRYRUN gluster volume reset-brick "$VOLUME" "$OLD_HOST":"$DISK_PATH" "$NEW_HOST":"$DISK_PATH" commit force