2

It is of course possible in a custom modules to use two different databases (and I mean different databases not different RDBMSs!), but is there a way to use two different databases, and then force Drupal to keep certain data in one and other data in the other?

For instance, keep nodes (and closely related tables) in one, and all site configuration in another. (Perhaps, while sorting it out, it might be useful to have a third as the default. That way everything that's not sorted into either the content or the configuration database would remain in the default until you decided where it best fit.)

How can this be done, without major hacking of Drupal's core?

3

If it's not possible at the Drupal level, this might be possible at the MySQL level using the FEDERATED storage engine. This is a thoroughly untested solution, however, and it might not play nice with Drupal.

1
  • 3
    Please keep in mind that the FEDERATED storage engine can only attach to MyISAM tables, and not InnoDB. If you can setup replication and restrict writes to a Master (with all tables InnoDB) and reads to Slaves, you could convert all tables on Slaves to MyISAM and then test this read/write splitting. FEDERATED tables would not be needed. +1 for this answer's outside-the-box thinking. – RolandoMySQLDBA Nov 14 '12 at 18:13
2

Sadly, without core hacking (and a lot of it), you can't accomplish this. And, even if you could, other third party modules would expect tables to be in the default database.

I suppose, an 'easy' trick would be to put a switch in the db_query function and base it on the table name. But that is still a hack and I have a feeling will cause more trouble than it is worth.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.