3

Does anyone have experience with setting up a Drupal Multi-Site with multiple Databases onto one RDS instance in AWS?

I was looking into this link below but I was not familiar with the exact formatting: https://www.drupal.org/node/18429

Here is my format:

$databases = array (
'default' =>  // main drupal db starts from here
array (
'default' => 
array (
  'database' => 'PubDB',
  'username' => 'PubUser',
  'password' => 'PASSWORD',
  'host' => 'pubtest.amazonaws.com',
  'port' => '3306',
  'driver' => 'mysql',
  'prefix' => '',
),
),'careers' =>  // additional database starts here
array (
'default' => 
array (
  'database' => 'careers', // additional database name
  'username' => 'PubUser', // additional database username
  'password' => 'PASSWORD', // additional database password
  'host' => 'pubtest.amazonaws.com',
  'port' => '3306',
  'driver' => 'sql', //the file is in sql format
  'prefix' => '',
)
),
);

And on my database.inc file I have:

function db_set_active($key = 'careers') {
return Database::setActiveConnection($key);
}
db_set_active();
1
  • I would like to bump this topic. – Lgalan90 Apr 27 '15 at 16:17
1

Finally got it. :)

Here are the steps I took on a RDS under a VPC:

  1. Created each Database individually on MySQL and then dumped each DB.

To log into your RDS MySQL:

mysql -h RDSEndPoint.rds.amazonaws.com -P 3306 -u MasterUser -p

To dump

mysql -u MasterUser -p -h RDSEndPoint.rds.amazonaws.com DB_Name_on_MySQL < /my/file/location/SQL_FILE.sql (You might need to change the .sql to .mysql)
  1. Once you have your DB's set up and ready to go, change your /var/www/html/MySiteFolder/sites/default/settings.php file

To

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'DB_Name_on_MySQL',
      'username' => 'MasterUser',
      'password' => 'PASSWORD',
      'host' => 'RDSEndPoint.rds.amazonaws.com',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
  1. You might receive this error (https://www.drupal.org/node/2394349):

    Command updatedb needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]

    The drush command 'updatedb' could not be executed. [error]

    A Drupal installation directory could not be found [error]

You can run the following two commands on where each of your sites index.php file is located:

drush dl rules 
drush updatedb 

You should be able to see your site now! If I'm missing something I would be glad to add it for future reference.

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.