Skip to content

Instantly share code, notes, and snippets.

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

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 with ServiceStack.Redis

The ServiceStack.Redis is an open source C# client for redis. The easiest way to get it is via NuGet.

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 connectionUri = new Uri(redisCloudUrl);
RedisClient redis = new RedisClient(connectionUri);

Testing ServiceStack.Redis

:::c#
redis.Set("foo", "bar");
string value = redis.Get<string>("foo");

Using Redis with BookSleeve

BookSleeve is offering a pipelined, asynchronous, multiplexed and thread-safe access redis client for C#. The easiest way to get it is via NuGet.

Configuring BookSleeve

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 connectionUri = new Uri(redisCloudUrl);
string host = connectionUri.Host;
int port = connectionUri.Port;
string password = connectionUri.UserInfo.Split(':').LastOrDefault();
RedisConnection redis = new RedisConnection(host, port: port, password: password);

Testing BookSleeve

:::c#
redis.Strings.Set(db, "foo", "bar");
var value = redis.Strings.GetString(db, "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: support@garantiadata.com.

Additional resources

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