Decrease device1 Size for MariaDB Xpand
device1 file in MariaDB Xpand is used for all database data, undo logs, temporary tables, Binlogs, and Xpand system objects. Xpand ensures that the
device1 file is the same size on all nodes of the cluster. Once the optimum size of the
device1 file is derived, it rarely requires change.
To increase the size of the
device1 file, see
ALTER CLUSTER RESIZE DEVICES.
To reduce the size of the
device1 file cluster-wide, follow these instructions.
The following procedure is meant to be completed on one Xpand node at a time. If you have space within your cluster, you may complete the cycle on more than one Xpand node at a time.
Verify, set initial global:
device_auto_resize_to_largestsystem variable controls how
device1files are consistently sized throughout your cluster. Ensure that this is initially set to false so it does not interfere with this process.
Verify that the initial setting of device_
auto_ resize_ to_ largest is false
SHOW GLOBAL VARIABLES LIKE 'device_auto_resize_to_largest';
Set the global to
FALSE, if necessary.
Run this only if needed:
SET GLOBAL device_auto_resize_to_largest = FALSE;
Softfail an node or nodes, if your cluster has enough free space.
After the Xpand node(s) have been softfailed and removed from the cluster, run the following from a command line prompt. This will result in a group change.
These commands will format the Xpand node to its default state and remove all the data.
Run these commands on each Xpand node that was softfailed
$ rm /data/clustrix/pnid $ systemctl stop clustrix $ systemctl start clustrix
Re-add the Xpand node to the cluster:
Use this syntax from the MariaDB client to create a default
device1file. This will result in a group change.
Run this from an Xpand node other than the Xpand node(s) just softfailed:
ALTER CLUSTER ADD '192.0.2.2';
device1file on each Xpand node added above by using the following control port command:
Run this command on each Xpand node whose IP was added to the cluster
$ nc localhost 2048 $ device resize deviceid size
For example, this sets the size for the first (and only) device of the system (
device1), to 800 GiB on the Xpand node to which you are connected. Do this on each Xpand node added above.
$ device resize 1 800g
MariaDB recommends that you leave 50 - 100 GiB of free or work space available on each drive. This is site-specific and MariaDB Support can provide guidelines for your specific workload.
The Rebalancer will automatically distribute data to the reconfigured Xpand node(s). If your cluster has enough free space, you do not need to wait for this operation to finish before continuing. For additional information, see "Manage the Rebalancer for MariaDB Xpand".
Repeat for all Xpand nodes:
Repeat steps 2-6 until all Xpand nodes of the cluster have had their
Set global for future use:
Once the procedure is complete on all Xpand nodes and the
device1files have been reduced in size, set the global variable
TRUE. This ensures that all future Xpand nodes added to the cluster will have their
device1files sized the same.
Do not set this global to
TRUEuntil all Xpand nodes in the cluster have completed this process.
Run this on one Xpand node after all device1 files have been decreased
SET GLOBAL device_auto_resize_to_largest = 'TRUE';