Should cloud database be centralized or distributed?

CodeIgniter: How easy is it to move my database to a different cloud instance?

  • More specifically, I'm asking if I move the entire database to a new cloud server, for the web application is it as simple as changing the database details under Database.php?

  • Answer:

    Provided your database server is set up correctly, yes it's that simple. Here's two things to check on your database server set-up: - Ensure your database has external networking enabled. For MySql, this means commenting out the line "bind-address = 127.0.0.1" and restarting the Sql server. - Ensure that the user you're using to authenticate with is set up to come from your web server. (The "host" field should be the IP address of the web server.) You'll also want to use the *internal* IP addresses if your web server is on the same network as your database server. If you run "ifconfig", you should see two ethernet addresses. You want the second one (eth1). This usually stops you from being billed for your data usage between the two servers. As a final check (still a MySql example), it's usually best to connect from your web server to your database server from the command line before committing changes. For example: mysql -u<username> -p<password> -h<database IP> <database name> If you get a MySql prompt and can run a few Sql commands, your application should be able to connect without a problem.

Jason Norwood-Young at Quora Visit the source

Was this solution helpful to you?

Other answers

Moving a database from one server to another is very simple indeed. Note that if the database is local to the site, you can use localhost. But if the database is remote to the site, then you need to use the hostname of the database server and make sure it allows remote connections. Also, here's the code I like to use to make switching databases as easy as a config setting. The ENVIRONMENT flag is set in the index.php file of your CI app. You can have one index file for each of your environments. switch (ENVIRONMENT) { case 'development': $db['default']['hostname'] = ''; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; break; case 'staging': $db['default']['hostname'] = ''; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; break; case 'production': $db['default']['hostname'] = ''; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; break; default: exit('[3] The application environment is not set correctly.'); break; }

Michael Fountain

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.