PHP Classes

The Easy Way of Running Your MySQL Applications in the Cloud

Recommend this page to a friend!
  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog The Easy Way of Runni...   Post a comment Post a comment   See comments See comments (3)   Trackbacks (0)  

Author:

Viewers: 17

Last month viewers: 3

Categories: PHP Tutorials, Sponsored

More and more sites are moving to cloud hosting services to assure a smooth growth path, as the sites require more servers to handle the audience growth.

As a developer, you want to ensure that your database is running smoothly in the cloud, but you do not want to be bogged down by tedious operations and everything else that goes into it, like the manual configuration, optimization, maintenance and development.

Read this article to learn how to connect your PHP app to a cloud database solution to simplify the way you run your database.




Loaded Article
Picture of Avigail Ofer
By Avigail Ofer United States

xeround.com

<email contact>

Contents

MySQL Everywhere

MySQL Challenges in the Cloud

The Database-as-a-Service Solution

Xeround Cloud Database Service Features in detail

How to connect your PHP application to Xeround Cloud Database?

Conclusion


Note: Once in a while the PHPClasses site provides space to allow sponsors to tell a bit more about relevant products that may be of the interest to PHP users that visit this site. This article is sponsored by Xeround, a company that provides a database-as-a-service for MySQL applications in the Cloud.

MySQL Everywhere

As a PHP developer, chances are that you use MySQL with your applications. Being a Free and Open Source database, MySQL is one of the most widely used databases today, particularly for Web applications.

As more and more applications are being migrated to the cloud, MySQL has come to rule the virtualized environment as well.

MySQL Challenges in the Cloud

Maintaining scalability and high availability of your MySQL database is challenging even in your physical data center, let alone in the dynamic environment of the cloud.

While scaling an application (by adding more servers and load balancers) is pretty much a no-brainer, on the database tier things are very different.

Scaling a database in general is no trivial task, and in the cloud it is way more difficult because of the need to quickly adjust to changing requirements in load. Scaling a database is tedious, painful and potentially risky in the sense that it can cause a temporary denial of service. 

Furthermore, you often need to commit to a larger machine for seasonal peaks, while the rest of the time those resources go underutilized.

Maintaining high-availability in the cloud also does not make life any easier. You need to closely monitor the dynamic cloud environment for any failures, and be able to react immediately and in a way that will be transparent to the application and that will not interrupt the service.

The Database-as-a-Service Solution

As a developer, you want to ensure your database is running smoothly, but you do not want to be bogged down by the tedious operations that are necessary to keeping it running properly at all times.

This is where Xeround comes in. Xeround offers a simple, yet extremely powerful, database-as-a-service for MySQL applications.

Rather than manually installing, configuring and managing a MySQL database on your cloud instance, you get your MySQL as a service. You can choose to run your cloud database on Amazon EC2, Rackspace, Heroku and other providers. You only need to connect your application to your cloud database and it simply works.

With Xeround Cloud Database availability, elasticity and all database management tasks are automatically handled by the service, so you can kick back and relax.

Xeround Cloud Database Service Features in Detail

  • Auto Scaling

    Your database automatically scales out across multiple nodes when more capacity or throughput are required, and shrinks back down when it is underutilized.

  • No Downtime SLA Guarantee

    Xeround's patented virtual partitioning technology automatically replicates your MySQL database and spreads it across cloud servers. So if one server become inaccessible for some reason, Xeround's auto-healing architecture ensures your database is always available from a healthy server in a way that is transparent to your application.

  • Scheduled Backups

    You should always have a snapshot backup of your database either for record keeping, failover or as an additional copy for continued development and quality assurance.

    Xeround's database service includes automatic hot backups, i.e backups are done on the fly keeping transaction-level consistency of data and with no downtime to your database and without the application being aware of the process.

    You can select the timing of scheduled backups, as well request that a backup be taken on demand.

  • Unlimited Throughput

    Xeround's databases automatically scale out by adding additional nodes when more throughput is required, so your application will never be stopped because it reached the limits of the current number of nodes.

  • Zero Maintenance

    The whole service is provided automatically, so you will never need to waste time on database maintenance tasks.

  • 100% MySQL Compatible

    Xeround cloud database is 100% compatible with the MySQL server software that you are used to.

  • No code changes to your app

    You do not need to change your current PHP application code to use Xeround. Just configure it to access its cloud database, similar to the way you connect to any MySQL database.

  • Phone, email and Web support

    Xeround provides 24 hours a day, 7 days a week, 365 days a year support by e-mail, Web based, or phone. Responses are guaranteed in up to 2 business days. 

How to connect your PHP application to Xeround Cloud Database?

Using Xeround Cloud Database service is simple, but you can verify that for yourself for free.
Here are a few steps you need to take.

  • Follow the instructions to create your free cloud database and import your data to it
  • Connecting your PHP application to Xeround Cloud Database is done in the same way as with connecting to a standard MySQL database

The code samples below use the following values:

  • Hostname: instance123.db.xeround.com
  • Port: 4567
  • Username: john
  • Password: malon
  • Database: mydb

PHP (Using Persistent Connections)

The actual code to use is the same as you are used to write to access a MySQL database.


<?php
$con = mysql_pconnect("instance123.db.xeround.com:4567", "john", "malon");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("mydb");
// rest of the code . . .
?>

PHP (Using MySQLi Extension)


<?php
$con = new mysqli("instance123.db.xeround.com", "john", "malon", "mydb", 4567);
// rest of the code . . .
?>

Importing Existing Databases

Importing existing databases to Xeround is easy. Just use the mysqldump command to generate a copy of your database structure and data. Then upload it to Xeround via the Web site.

Check out our developers’ resources for the user guide and to learn more about other details.

Conclusion

Xeround Cloud Database service addresses the problems of reliably dealing with database scalability and availability in cloud hosting services, so you do not have to do that yourself.

You can learn more about Xeround here , but feel free to ask any questions posting a comment to this article.



You need to be a registered user or login to post a comment

1,611,040 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:



Comments:

2. can i use php adodb? - Jose C (2011-12-08 19:05)
Can i use php adodb... - 1 reply
Read the whole comment and replies

1. Xeround - Kevin Moran (2011-12-07 22:19)
MySql in the cloud... - 0 replies
Read the whole comment and replies



  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog The Easy Way of Runni...   Post a comment Post a comment   See comments See comments (3)   Trackbacks (0)