Over time, the database files within the datastore can become fragmented, meaning that the data within them is structured inefficiently, so the files take up an unnecessarily large amount of disk space, and data access speed can suffer. The tw_ds_offline_compact
utility enables you to compact the datastore by writing new copies of the database files. As it creates new files, the data is packed more efficiently, helping to alleviate lost disc space caused by fragmentation.
The tool operates on an offline system, meaning that the tideway services must be stopped when you use this tool.
Compacting the datastore may take a long time. In a large datastore, this may be many hours. Once a compaction starts, you should not interrupt it. To prevent loss of terminal connection interrupting the compaction, you should run tw_ds_offline_compact
inside the screen utility which is installed on the appliance. The user example below shows how to do this.
To use the utility, enter the following command:
tw_ds_offline_compact [options]
where options are any of the options described in the following table and the common command line options described in Using command line utilities.
Warning
Because the utility touches all of the data, you must create a backup of the datastore before running it.
Command Line Option |
Description |
---|---|
|
Fix the databases following an interrupted compaction. See recovering from an interrupted compaction. |
|
Proceed immediately with no questions. |
|
Displays help messages and exits. |
The following example shows backing up a datastore and then compacting it using the tw_ds_offline_compact
utility.
Back up the datastore using the appliance backup tool.
Run the screen utility. Enter:
[tideway@appliance01 ~]$ screen
Stop the tideway services.
[tideway@appliance01 ~]$ sudo /sbin/service tideway stop
Run the tw_ds_offline_compact
utility. Enter:
[tideway@appliance01 ~]$ tw_ds_offline_compact
The utility checks that the tideway services have been stopped and that there is sufficient disk space to continue. It then reports the data directory, largest database file, and the free space available. Before proceeding you must confirm that you have made a backup of the datastore.
yes
to confirm that you have made a backup of the datastore. yes
to start the compaction. Start the tideway services. Enter the following command:
[tideway@appliance01 ~]$ sudo /sbin/service tideway start
If you lose the connection to the appliance and you have used screen, you can reconnect to the appliance and recover the virtual terminal running the compaction. To do this:
List the current screen sessions. Enter:
[tideway@appliance01 ~]$ screen -ls There is a screen on: 23274.pts-0.appliance01 (Detached) 1 Socket in /var/run/screen/S-tideway.
If there is only one screen listed, you may re-attach to it with a simple command:
[tideway@appliance01 ~]$ screen -r
If there is more than one, copy the screen identifier:
[tideway@appliance01 ~]$ screen -r 23274.pts-0.appliance01
The virtual terminal is recovered and you can see how the compaction is progressing until completion.
Start the tideway services. Enter the following command:
sudo /sbin/service tideway start
If the compaction has been interrupted in some way, then the database files are left in a partial state and the datastore cannot run. You can recover from this situation in the following ways:
tw_ds_offline_compact
utility again and allow it to complete without interruption. See the procedure above.tw_ds_offline_compact
utility again with the --fix-interrupted
option. This fixes the datastore but does not perform any more compaction.