I have been migrating an older server running apache2 + mysql under ubuntu to a new server running debian (wheezy). The migration works fine while the databases are storted localy (in our case /srv/mysql), but when i try to move them to our centralized storage running NFS and creating symbolic links to the moved files mysql does not seem to find the databases at all. I get no errors from mysql, it just seems to believe there is no such database.
This is the layout of /srv/mysql (few examples):
user@server:/srv/mysql# ls -al
total 135440
drwxr-xr-x 50 mysql mysql 4096 May 22 09:59 .
drwxr-xr-x 7 root root 4096 May 22 09:59 ..
drwxrwx--- 2 mysql mysql 4096 May 21 20:13 database_dir_1
drwx------ 2 mysql mysql 4096 May 21 19:07 database_dir_2
drwxrwx--- 2 mysql mysql 4096 May 21 20:15 database_dir_3
drwx------ 2 mysql mysql 4096 May 21 20:15 database_dir_4
drwxrwx--- 2 mysql mysql 4096 May 21 20:15 database_dir_5
How i create symbolic links:
mv /srv/mysql/database_dir_1 /mnt/centralstorage/customer1/db/database_dir_1
ln -s /mnt/centralstorage/customer1/db/database_dir_1 /srv/mysql/database_dir_1
ls -al /srv/mysql/
drwxrwx--- 1 root root 28 May 21 20:13 database_dir_1 -> /mnt/centralstorage/customer1/db/database_dir_1
After this mysql no longer sees database_dir_1, but it is fully browseable from cli.
The mounts for /mnt/centralstorage looks like this:
192.168.12.222:/srv/storage/customers on /mnt/centralstorage/ type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.12.222,mountvers=3,mountport=49535,mountproto=udp,local_lock=none,addr=192.168.12.222)
And the export on the central server:
/srv/storage 192.168.12.30(rw,async,no_subtree_check,no_root_squash)
(all names and such have been changed)
Anyone see any issues with the setup?
With regards, FrontSlash
Edit1:
After some help from @Fox the problem seems to be the NFS connection. Does anyone see any issues in the nfs configuration i posted above? If you need more information i will post it.
Edit2:
Did a quick test, exportet a new folder on the NFS server, /srv/temp, with the same settings as the other two exports.
Mounted this on the sql server with fstab instead of the previous startup-script that ran.
The script simply did a
mount $host:$dir $mnt_dir/$mmount
Which produced this mount:
192.168.12.222:/srv/storage/customers on /mnt/centralstorage/ type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.12.222,mountvers=3,mountport=49535,mountproto=udp,local_lock=none,addr=192.168.12.222)
The fstab mount:
192.168.12.222:/srv/temp /mnt/temp nfs rw,sync,hard,intr 0 0
Produced this:
192.168.12.222:/srv/temp on /mnt/temp type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.12.222,mountvers=3,mountport=49535,mountproto=udp,local_lock=none,addr=192.168.12.222)
And here is the weird part, now moving the database dir to the /mnt/temp folder, and creating a link to this, it works. I will continue exploring.
Edit3: Solution added as answer, nfs-kernel-server had option --manage-gids in /etc/nfs-kernel-server that affected secondary groups for the mysql user.