• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question MySQL on another path (same server diffent raid)

Filmica

New Pleskian
Hello,
please I would have a suggestion about a new next plesk installation, because I'm newbie.
I explain my question.
I've a server metal with 3 raid systems on it, 1 Raid-0 for the S.O. and 2 Raid-5 as storage.
Is there a method to change the default MySQL path during the installation via terminal, for example, from disk sda to disk sdb?
Because seems that after I have installed the server, the paths cannot be altered without removing and reinstalling the server instance.
Thank you in advance for any kindle reply.
Best
Mike
 
So you would like your MySQL databases to reside on one of the RAID-5 arrays, instead of the RAID-0 on which they are now?

Can you please post how is your server partitioned?

Code:
parted -l
df -h
 
Thank you for your reply.
Yes, correct. I would like that my MySQL database to reside in one of the RAID-5 array instead of the RAID-0.

Code:
parted -l
returns me:

Model: IBM ServeRAID M5015 (scsi)
Disk /dev/sda: 747GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End    Size   File system  Flags
 1      0.00B  747GB  747GB  ext4


Model: IBM ServeRAID M5015 (scsi)
Disk /dev/sdb: 1245GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  1245GB  1245GB  ext4


Model: IBM ServeRAID M5015 (scsi)
Disk /dev/sdc: 119GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  538MB  537MB  fat32              boot, esp
 2      538MB   119GB  118GB  ext4

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

df -h

Filesystem      Size  Used Avail Use% Mounted on
udev             63G     0   63G   0% /dev
tmpfs            13G  1.5M   13G   1% /run
/dev/sdc2       109G   16G   88G  15% /
tmpfs            63G     0   63G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            63G     0   63G   0% /sys/fs/cgroup
/dev/sdb        1.2T   77M  1.1T   1% /media/webB
/dev/sda        684G   73M  649G   1% /media/webA
/dev/sdc1       511M  6.1M  505M   2% /boot/efi
/dev/loop2       89M   89M     0 100% /snap/core/7396
/dev/loop1       90M   90M     0 100% /snap/core/7713
tmpfs            13G     0   13G   0% /run/user/1000
 
In short, default MySQL path can't be changed during the Plesk installation, but there are other ways to achieve what you want.

First, you could mount a partition (doesn't have to be the entire RAID array) from one of the RAID-5 arrays as /var/lib/mysql. This would be a sound choice.

Second, you could change the server configuration to look for MySQL databases in another directory. But I believe Plesk is reluctant to support changing the MySQL data location on linux because this was known to cause various issues in the past.

Third, you could change /var/lib/mysql to be a symlink to another directory. This approach would require more research, I'd look for Plesk related issues reported in the past.

BTW, which OS (and version) are you using? Do you have AppArmor or SELinux active?

How did you plan to use /media/webA and /media/webB?

How about /var/www/vhosts and /var/qmail, is it OK if they stay on RAID-0 array? The former location contains web site files, the latter contains email contents.
 
Ok I think to have understood the problem.
The OS is Ubuntu 18.04 LTS with AppArmor.
My initial idea was to use RAID-0 array only for SO and /media/webB for hosting service and /media/webA for backups. The same with /var/www/vhosts and /var/qmail, I would stay into the /media/webB with all account folders. But at this point, maybe, the best solutions is to use only the RAID-5 arrays for SO and backups (/media/webB for SO and /var/www/vhosts and /var/qmail; /media/webA for backups) in my opinion.
 
hello,

you can (re-)define path for DB files in MySQL/MariaDB config file. It should be something like:

[mysqld]
#
# * Basic Settings
#
datadir = /var/lib/mysql



to change mysql data location you should
1. stop all services that can try reach DB.
2. stop mysql server
3. copy existing data with all permissions to the new path, something like
rsync -av /var/lib/mysql/ /media/webA/mysql/

change datadir in config to "datadir = /media/webA/mysql"; save changes
4. start mysql server

if you have everything done correctly - mysql will be started successfully and you will be able to connect to it.
in mysql you can check current datadir by the command
> show variables like '%datadir%';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| datadir | /var/lib/mysql/ |
+---------------+-----------------+

5. start all services that were stopped at step (1), or simply reboot the server
 
Back
Top