Thursday, July 12, 2012

Configuring Aegir Hosting System to use a Remote MySQL server

This post is a quick one on how to configure the Aegir hosting system to host it's database in a seperate MySQL database server. 

With the normal Aegir hosting system instillation , it expects the local MySQL database server to host it's database which contains various aspects of hosted site configuration details. To move this SQL database to a separate MYSQL database server you need to take following steps during/after the Aegir installation.

1. Follow the instructions given in the AegirInstallation Guide

2. Once Aegir has been istalled sucessfully , connect to the local MySQL sever and take a backup of the Aegir database. Also note down the service user account it creates under the database server.

3. Migrate the database to the remote MySQL sever and create the Aegir service user account in it. You should give appropriate rights to this user account so that it can access and manage the Aegir database.

4. Go to the Aegir instalation folder (usually /var/aegir/)and edit following configuration files so that Aegir can connect to the remore MySQL server.


File 1:
Pah:/var/aegir/hostmaster-6.x-XXX/sites/<Your Site Name>/drushrc.php


$options['db_type'] = 'mysqli';
$options['db_host'] = '<database Server Name>';
$options['db_port'] = 3306;
$options['db_passwd'] = '<Database Password>';
$options['db_name'] = '<Database Name>';
$options['db_user'] = '<Database User Name>';
$options['site_ip_addresses'] = array ();


File 2: /var/aegir/config/server_master/apache/vhost.d/<Your Site Name>
DocumentRoot /var/aegir/hostmaster-6.x-XXX

ServerName  <Your Site Name>
SetEnv db_type  mysqli
SetEnv db_name   <Database Name>
SetEnv db_user   <Database User Name>
SetEnv db_passwd   <Database Password>
SetEnv db_host   <database Server Name>
SetEnv db_port  3306

5. Thats about it. Restart the server and make sure that Aegir is using the remote MySQL server insted of the local one. Then you can uninstall the local MySQL server instance by typing : sudo apt-get --purge remove mysql-server




No comments:

Post a Comment