How to change dbserver host after installing aegir

Events happening in the community are now at Drupal community events on www.drupal.org.
tusharkanta's picture

We have successfully installed aegir by point dbserver to the localhost. But we need to change the dbserver to another machine. I want to check if there is a way to do some minor configuration changes so that the existing installation will work with new db server.

I made following changes:

In /var/aegir/hostmaster-6.x-0.4-alpha3/drushrc.php file

Changed options['master_db'] = 'mysql://aegir:aegir@localhost'; to
$options['master_db'] = 'mysql://aegir:aegir@96.31.74.44';

Where 96.31.74.44 is the dbserver host.

I saved changes and restarted apache. When I tried to create a new site, install cronjob fails. The error log is given below:

Posted Wed, 01/20/2010 - 00:00 by peppervillageAdmin
Site: testtushar.peppervillage.mobi
Status: Failed
Executed: Wed, 01/20/2010 - 00:01
Execution time: 0 sec
Log message
Log message
Task starts processing
Running: /usr/bin/php /var/aegir/drush/drush.php --root='/var/aegir/pepperdev' 'provision' 'install' 'testtushar.peppervillage.mobi' --backend
The external command could not be executed due to an application error.
Drush bootstrap phase : _drush_bootstrap_drush()
Loading drushrc "/var/aegir/drush/drushrc.php" into "drush" scope.
Drush bootstrap phase : _drush_bootstrap_drupal_root()
Loading drushrc "/var/aegir/pepperdev/drushrc.php" into "drupal" scope.
Initialized Drupal 5.20 root directory at /var/aegir/pepperdev
Found command: provision install
Initializing drush commandfile: provision_apache
Undefined index: base_url
Initializing drush commandfile: provision_drupal
Initializing drush commandfile: provision_mysql
Undefined index: db_url
Including /var/aegir/.drush/provision/web_server/install.provision.inc
Including /var/aegir/.drush/provision/platform/install.provision.inc
Including /var/aegir/.drush/provision/db_server/install.provision.inc
Created sites/testtushar.peppervillage.mobi
Changed permissions of sites/testtushar.peppervillage.mobi to 0755
Created sites/testtushar.peppervillage.mobi/files
Changed permissions of sites/testtushar.peppervillage.mobi/files to 2770
Created sites/testtushar.peppervillage.mobi/files/tmp
Changed permissions of sites/testtushar.peppervillage.mobi/files/tmp to 2770
Created sites/testtushar.peppervillage.mobi/files/images
Changed permissions of sites/testtushar.peppervillage.mobi/files/images to 2770
Created sites/testtushar.peppervillage.mobi/files/pictures
Changed permissions of sites/testtushar.peppervillage.mobi/files/pictures to 2770
Created sites/testtushar.peppervillage.mobi/themes
Changed permissions of sites/testtushar.peppervillage.mobi/themes to 0755
Created sites/testtushar.peppervillage.mobi/modules
Changed permissions of sites/testtushar.peppervillage.mobi/modules to 0755
Changed ownership of sites/testtushar.peppervillage.mobi/files
Changed group ownership of sites/testtushar.peppervillage.mobi/files
Changed ownership of sites/testtushar.peppervillage.mobi/files/tmp
Changed group ownership of sites/testtushar.peppervillage.mobi/files/tmp
Changed ownership of sites/testtushar.peppervillage.mobi/files/images
Changed group ownership of sites/testtushar.peppervillage.mobi/files/images
Changed ownership of sites/testtushar.peppervillage.mobi/files/pictures
Changed group ownership of sites/testtushar.peppervillage.mobi/files/pictures
Granting privileges to site_536@74.50.104.89 on site_536
Access denied for user 'aegir'@'74.50.104.89' to database 'site_536' query: GRANT ALL PRIVILEGES ON site_536.* TO site_536@74.50.104.89 IDENTIFIED BY 'cyoAQ4pKVF'
Could not GRANT user access.
Access denied; you need the RELOAD privilege for this operation query: FLUSH PRIVILEGES
Created site_536 database
Generate settings.php file
Changed permissions of settings.php to 0440
Change group ownership of settings.php to apache
Drush bootstrap phase : _drush_bootstrap_drupal_site()
Initialized Drupal site testtushar.peppervillage.mobi at sites/testtushar.peppervillage.mobi
Including version specific file : /var/aegir/.drush/provision/platform/drupal/install_5.inc
Drush bootstrap phase : _drush_bootstrap_drupal_configuration()
SQLSTATE[28000] [1045] Access denied for user 'site_536'@'74.50.104.89' (using password: YES)
Drush was not able to start (bootstrap) the Drupal database. Hint: This err... (Expand)Drush was not able to start (bootstrap) the Drupal database. Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database. Drush was attempting to connect to : PHP configuration : /etc/php.ini Drupal Root : /var/aegir/pepperdev Drupal version : 5.20 Site Path : sites/testtushar.peppervillage.mobi Site URI : http://testtushar.peppervillage.mobi Database Driver : mysql Database Hostname : 96.31.74.44 Database Username : site_536 Database Name : site_536 Database Password : cyoAQ4pKVF You can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line or $options['uri'] in your drushrc.php file.
Drush command could not be completed.
Output from failed command :
An error occurred at function : drush_hosting_hosting_task
Changes for drush_hosting_hosting_task module have been rolled back.
Command dispatch complete

====================================================================================

Please guide me how to go about changing the dbhost in an existing aegir installation.

Comments

The error is shown: Access

mig5's picture

The error is shown:

Access denied for user 'aegir'@'74.50.104.89' to database 'site_536' query: GRANT ALL PRIVILEGES ON site_536.* TO site_536@74.50.104.89 IDENTIFIED BY 'cyoAQ4pKVF'
Could not GRANT user access.
Access denied; you need the RELOAD privilege for this operation query: FLUSH PRIVILEGES

If 'aegir' is your mysql superuser (as seen in the hosting_db_server table in the aegir database), you need to grant privileges for that user to 74.50.104.89

You probably did this during installation;

GRANT ALL PRIVILEGES ON *.* to 'aegir'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

Repeat that but replace 'localhost' with '74.50.104.89'

If you've changed the database server in the drushrc.php, you should probably edit the Database Server node in Aegir (or edit the hosting_db_server table directly) and change the hostname there too, to the IP. However this might affect existing sites next time they get verified (the db connect string will be overwritten to point to the other database server.. perhaps this is ok for you if you're fully migrating your site databases to a different server).

Incidentally, you said that '96.31.74.44' is the new master host so I don't know what this 74.50.104.89 IP is.. the old IP?

Aegir user not ale to create mysql users

santhosh_kumar's picture

Hi mig, The issue is with the mysql aegir not able to create new users for new aegir sites.
i.e When ever we create a new site from aegir it creates a new user,new database, and a pwd for that particular user but in my case it is not able to create user...

Thanks
Santhosh

Exactly.. the aegir superuser

mig5's picture

Exactly.. the aegir superuser cannot create new users or database because it is not configured to do so :)

Access denied for user 'aegir'@'74.50.104.89' to database 'site_536' query: GRANT ALL PRIVILEGES ON site_536.* TO site_536@74.50.104.89 IDENTIFIED BY 'cyoAQ4pKVF'

There is no such grant in MySQL for 'aegir'@'74.50.104.89'. MySQL treats users as not just 'user' but 'user@somewhere'. So what you probably have is 'aegir'@'localhost' or somesuch but that is not seen as the same user, really.

Make a privileged grant for 'aegir'@'74.50.104.89' to be able to create more databases and users, and this error will go away.

Issue Solved

santhosh_kumar's picture

Hi all,

Issue is solved as the issue was with the mysql "aegir" user privileges.
As soon as i flushed the privileges it started working.

Cheers
Santhosh

Good to hear.

mig5's picture

Good to hear.

Aegir hosting system

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: