Skip to content

Instantly share code, notes, and snippets.

@Yiftach
Forked from kehati/redis-cloud overview.md
Created November 5, 2012 08:03
Show Gist options
  • Save Yiftach/4015931 to your computer and use it in GitHub Desktop.
Save Yiftach/4015931 to your computer and use it in GitHub Desktop.
AppHarbor - Redis Cloud Docs

Redis Cloud is a fully-managed service for running your Redis dataset. You can quickly and easily get your apps up and running with Redis Cloud through its add-on for AppHarbor, just tell us how much memory you need and get started instantly with your first Redis database. You can then add as many Redis databases as you need (each running in a dedicated process, in a non-blocking manner) and increase or decrease the memory size of your plan without affecting your existing data. You can easily import an existing dataset to any of your Redis Cloud databases, from your S3 account or from any other Redis server. Daily backups are performed automatically and in addition, you can backup your dataset manually at any given time.

Install Redis Cloud

In the “Add-ons” tab on your app console click on the Redis Cloud add-on, and choose your Redis Cloud plan.

Once Redis Cloud has been added, you will notice a new configuration variable: REDISCLOUD_URL in the Configuration variables tab on your app console, containing the username, password, hostname and port of your first Redis Cloud database.

Note: as database provisioning is carried out asynchronously, please wait until the creation and initialization of the database is complete. This process shouldn't take more than 60 seconds. You are ready to go when the "hostname" value in the `REDISCLOUD_URL` environment variable is different than your "localhost".

Next, setup your app to start using the Redis Cloud add-on.

Using Redis from C#

The ServiceStack Redis is an open source C# client for redis.

Installing ServiceStack Redis

You can download the ServiceStack Redis package here, and add it as a reference to your project. Note that any reference should be included in your repository you push to AppHarbor.

Another way of managing your project's dependencies in Visual Studio is using NuGet extension, a recommended solution for handling dependencies by AppHarbor.

Configuring ServiceStack Redis

Configure connection to your Redis Cloud service using the REDISCLOUD_URL configuration variable and the following code snippet:

:::c#
String redisCloudUrl = ConfigurationManager.AppSettings["REDISCLOUD_URL"].ToString();
Uri uri = new Uri(redisCloudUrl);
String host = uri.Host;
int port = uri.Port;
String password = uri.UserInfo.Substring(uri.UserInfo.IndexOf(":") + 1);
RedisClient redis = new RedisClient(host, port, password);

Testing ServiceStack Redis

:::c#
redis.Set("foo", "bar");
String value = System.Text.Encoding.UTF8.GetString(redis.Get("foo");	

Dashboard

Our dashboard presents all performance and usage metrics of your Redis Cloud service on a single screen, as shown below:

Dashboard

To access your Redis Cloud dashboard, simply click the “Go to Redis Cloud” link in the Redis Cloud add-on management page on your app console.

You can then find your dashboard under the MY DATABASES menu.

Adding Redis databases to your plan

Redis Cloud allows you to add multiple Redis databases to your plan, each running in a dedicated process, in a non-blocking manner (i.e. without interfering with your other databases). You can create as many databases as you need, limited by the memory size of your plan. Your first Redis database is created automatically upon launching the Redis Cloud add-on and its URL and credentials are maintained in the REDISCLOUD_URL configuration variable. To add more databases, simply access your Redis Cloud console and click the New Redis DB button in the MY REDIS DBs > Manage page. You will have to manually set the connection between your application and your new Redis database (created through the Redis Cloud console), as only one canonical URL is supported by the add-on scheme of appharbor.com.
You can also delete a Redis database created through your Redis Cloud console, however, your first Redis database can only be deleted by entirely removing the add-on.

Migrating between plans

Plans migration is easy and instant. It requires no code change and has no effect on your existing datasets. To upgrade a plan, simply go to the Redis Cloud add-on management page on your app console, and click the Upgrade button on the plan you choose.

Note: Only plan upgrade is supported currently.

Removing the add-on

To uninstall Redis Cloud add-on go to the Redis Cloud add-on management page on your app console, and click Uninstall.

This will destroy all associated data and cannot be reversed!

Support

Contact us if you have any questions at: service@garantiadata.com.

Additional resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment