The fast way:
# move primaries off node gnt-node migrate $node # move secondaries off node gnt-node evacuate --secondary-only $nodeSometimes nodes fail to migrate. I don't know why. I just use the gnt-instance failover command to move them which requires a reboot. Sometimes the secondary disks don't move either. This is more annoying because hail crashes before making a plan for you. I have written the following script to, stupidly, move all the secondaries off of one node onto other nodes so you can reboot a node in your cluster without fear.
#!/bin/bash
evac_node=$1
if [ -z $evac_node ]; then
echo "Please specify a node to evac"
exit 1
fi
echo "Evacuating secondaries from $evac_node"
HYPERVISORS=`wget --no-check-certificate -O- https://localhost:5080/2/nodes 2>/dev/null | grep id | awk '{print $NF}' | tr -d \",`
for instance in `gnt-instance list -o name,snodes | grep $evac_node | cut -d " " -f 1`
do
current_primary=`gnt-instance list -o name,pnode | grep $instance | awk '{print $NF}'`
target_node=`echo $HYPERVISORS | sed 's/ /\n/g' | grep -v $evac_node | grep -v $current_primary | sort -R | head -n 1`
echo "gnt-instance replace-disks -n $target_node $instance"
gnt-instance replace-disks -n $target_node $instance
done
Happy hacking!