How to use multiple databases to move some tables from main database.
Move some tables into another database.
Example:
$databases['default']['default'] = array(
'database' => 'drupal8_default',
'username' => 'root',
'password' => 'THEPASSWORD',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
//Add prefix to separate databases
'prefix' => array(
//Use a shared database for the users (not recomended, Just for example)
'users' => 'drupal8_shared.',
//Move cache into another database
'cache_bootstrap' => 'drupal8_cache.',
'cache_config' => 'drupal8_cache.',
'cache_container' => 'drupal8_cache.',
'cache_data' => 'drupal8_cache.',
'cache_default' => 'drupal8_cache.',
'cache_discovery' => 'drupal8_cache.',
'cache_dynamic_page_cache' => 'drupal8_cache.',
'cache_entity' => 'drupal8_cache.',
'cache_menu' => 'drupal8_cache.',
'cache_render' => 'drupal8_cache.',
'cache_toolbar' => 'drupal8_cache.',
),
);
//Configure shared database
$databases['shared']['default'] = array(
'database' => 'drupal8_shared',
'username' => 'root',
'password' => 'THEPASSWORD',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
//Configure cache database
$databases['cache']['default'] = array(
'database' => 'drupal8_cache',
'username' => 'root',
'password' => 'THEPASSWORD',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
Comments1
pgsql
any idea how to get this to work with pgsql? i would like to move the forum to a separate database and access from a different install on another server.