Reputation: 3806
I have a requirement to store two Innodb database files on separate partitions. (one database on raid0 for speed, the other on raid1 for stability)
From what I've read, the only way to accomplish this is by using innodb_file_per_table
and symlinking .ibd and .frm files wherever-they-may-live to the configured mysql storage directory (/var/lib/mysql on my system), where the ibdata1 file must live (for table metadata).
Is this the only way to accomplish the split?
Is there an innodb analog to myisam's TABLE/INDEX DIRECTORY?
Upvotes: 5
Views: 13851
Reputation: 31
Scenario 2 MOVE 1 TABLE TO NEW DATA DIRECTORY
Platform - Windows Server,MySQL 5.6
Database - Test
Table - Employee
Source Data directory - D:\Program Files\MySQL\MySQL Server 5.6\data\test\
Destination Data directory -E:\data\New_data\test\
STEPS
Ensure the global variable innodb_file_per_table = 1
Stop MySQL server
Move the innodb file employee.ibd file to separate disk/folder by simple file move to E:\data\New_data\test\
Note - Keep the employee.frm in the original data directory D:\Program Files\MySQL\MySQL Server 5.6\data\test\
in the source data directory - D:\Program Files\MySQL\MySQL Server 5.6\data\test\ - Create a text file with .isl extension e.g. employee.isl Edit the .isl file and type in the new path to the employee.ibd file that you moved.
In the File -D:\Program Files\MySQL\MySQL Server 5.6\data\test\employee.isl E:\data\New_data\test\employee.ibd
grant write permission to teh folder E:\data
Start MySQL server
use test;
select * from employee
Upvotes: -1
Reputation: 1114
Just to update this post if someone ever come across this, InnoDB now support data directory since version 5.6. No symlink (not recommended), and works for both *nix and Windows.
Requirements:
innodb_file_per_table = 1
Scenario 1 (create new tables):
It is as simple as specifying the DATA DIRECTORY options during creation of table.
CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/alternative/directory';
Scenario 2 (moving existing table to separate disk):
This involves few more steps (MySQL server restart required) but still pretty straight forward. And it doesn't requires the table to have DATA DIRECTORY option specified during table creation.
/alternative/directory/table_name.ibd
Now subsequent changes to the moved table will be save into .ibd file in new path.
For reference please refer to MySQL official doc: http://dev.mysql.com/doc/refman/5.6/en/tablespace-placing.html
Upvotes: 9
Reputation: 3438
I just wrote a blog post on this today: http://www.mysqlperformanceblog.com/2010/12/25/spreading-ibd-files-across-multiple-disks-the-optimization-that-isnt/
You don't want to do the symlinking thing - and InnoDB does not support DATA DIRECTORY/INDEX DIRECTORY.
You actually need stability of the data system wide for InnoDB. Let's say -
If you have two very different data requirements, you need two installs of MySQL ;)
Upvotes: 2