Changing the DataDir before or after configuring the Cluster?

(educational purposes)

Hey comm,

actually i’m just trying to understand the working of xtraDB Cluster and how to set it up proberly. In this situation i want to use 3 cloud servers, where each has a ssd volume connected.

Cause the SSD of the server itself is very small, i want to have the data directory of the xtraDB Cluster on these SSD volumes which are connected to the server, because i can upsize them when there is a need of it (up to 10 TB).

I already done the installation on the 3 servers as follows:

Now i would come up to configure nodes for write-set replication:

And i’m asking myself, if i should change the DataDir to the SSD volume before i do this or when is the best time for it.

Someone can give me a recommendation? Maybe a doc link, cause i didnt find something about changing the dataDir?

Best regards

Hello @Keon,
MySQL’s data directory is set via config file /etc/my.cnf (or /etc/mysql/my.cnf depending on your OS). Look for [mysqld] section, and datadir= Shut down MySQL. Change this parameter to a new value. Copy the contents of /var/lib/mysql (the default) to this new location, ensure permissions/ownerships are correct, and then start MySQL.
Alternatively, you could have simply mounted your block device as /var/lib/mysql and not needed to change any mysql settings.