Redis is an open source, advanced key-value store. It is often referred to as a data structure Server since keys can contain strings, hashes, lists, sets and sorted sets. Redis is great for the following web use cases (taken from my friend the excellent HighScalability blog, more details here):
- Latest items in a Craigslist or eBay clone
- Leaderboards or Digg & Reddit style voting sites
- Counters and Rate Limiting like number of API calls per client per month
- Stats tracking, like unique page views
- Pub/Sub, like Amazon SNS (topic-based message filtering, although content-based filtering can be achieved in your app)
- Message queues, like Amazon SQS
- Caching HTML fragments, like you would do with Memcached
The Redis Role currently uses 2.2.X (2.2.5 on CentOS and latest 2.2.X branch from apt repository on Ubuntu).
Redis Roles are available under the Farm Designer (Main Menu > Farms > Add Farm). If you cannot find something that suits your needs, we recommend using the Role Builder: Main Menu > Roles > Add Role > Role Builder.
Scalr provides useful information about your Redis databases such as the password, DNS endpoints, and data bundles as they run.
To access your Redis Status, go to Main Menu > Farms > Select your Farm > Actions Button (rightmost column) > Redis Status.
Please note that the Redis Status option will only appear in the Actions Menu for an active (running) Farm.
Scalr generates a unique password for you to connect to your application. To access this password, click on Connection Details underneath General in the Redis Status Panel. You may also disable Redis authentication for speed purposes. In this case, Scalr will automatically create secure IPtable rules to only allow access to your Redis Servers from Servers that are in the same Farm.
When choosing password-less authentication in Redis, Scalr will override all rules to close traffic from all IP's with the exception of IP's of Servers in the same Farm.
Under the same Redis status, Scalr provides to connect your application to your database. Information on how to use these endpoints to connect your database to your application can be found on the Connecting to the Database Endpoints page of the documentation.
You can manually create backups of your Redis databases. You can learn more about databases backups in the Backups section of this page.
The Cluster Map can be used to view the current Master-Slave hierarchy for your Redis servers. To view this map, click on the Actions Button next to the Farm while in the Farms List and then select Redis Status. You may click on a particular slave or the master to see additional information about the selection in the Redis Status Screen. New slaves can be added by clicking on Launch new slave. To learn more, please refer to the Scaling section of this page.
New slaves can be added by clicking on Launch new slave and then clicking on the Launch Button in the provided confirmation window (shown below).
As the new slave is launched in Scalr, it will have a Pending Status until it initializes. You will see a confirmation in the Cluster Map for the added slave "Replication is ok" if it is launched and functioning correctly. To learn more, please refer to the Scaling section of this page.
As an in-memory database, Redis holds the whole dataset in RAM. Since RAM is volatile (a power down or crash results in total loss of all memory data), Redis offers two persistence models:
- Snapshotting: A semi-persistent durability mode where the dataset is asynchronously transferred from memory to disk from time to time
- Append-only: A file or journal that is written as operations modifying the dataset in memory are processed, which allows Redis to rewrite the append-only file in the background in order to avoid an indefinite growth of the journal.
Backups can be either scheduled automatically in the Farm Designer or created manually on the Redis Status Panel. For Amazon EC2 users, their backups will be stored on Amazon S3. Please keep in mind that backups and data bundles are different:
- Data Bundles are snapshots of the EBS volume containing the data (binary storage).
- Backups are snapshot of the EBS volume containing the data by running a database dump (object storage).
Backups are taken on slaves and data bundles are taken only on the master server. This is due to technical limitations.
To setup your backup automatically, go to Main Menu > Farms > Select your Farm > Actions Button (rightmost column) > Configure > Click on the Redis Role > Databases Settings.
To create a backup manually, go to Main Menu > Farms > Select your Farm > Actions Button (rightmost column) > Redis Status.
A confirmation prompt will appear prior to the creation of a Database Dump or Binary Storage Snapshot. For Binary Storage Snapshots you can elect to use the slave Server for the bundle by ticking the checkbox next to "Use SLAVE server for data bundle". Click on the OK Button to initiate the backup in the Redis Status Panel.
You can see the progress of the current Database Dump (Backup Bundle).
If Server #1 (the master) becomes unavailable (hardware fault, server crash, alien invasion), then Scalr will detect it and trigger failover. This happens by promoting one of the slave servers, say Server #2, to become a new master, and reconfiguring Servers #3 and #4 to replicate from the new master (Server #2). If you set minimum_instances to 2, then Scalr will bring up a slave server (Server #2) even if the load is low, in addition to the master server (Server #1). This is recommended if you need quick failover. Also, when a Server fails, Scalr detects it and removes that record from the DNS zone. This means that reads and writes directed at the endpoint will no longer hit the failed Server.
|More details on Redis and specific behaviors for Rackspace and AWS can be found in the Scaling section of the Developer Reference.|
Slave election has a preference for slaves in the same Availability Zone (re-attaching a volume is faster than creating a snapshot then a volume). In the future, we plan on including timeouts to failover without volume re-arrangement in case of cloud-wide volume failure.
It is useful to note that when a Server fails, Scalr will remove the record corresponding to it from its DNS Zone. This prevents stale endpoints, which causes reads and writes to hit a dead Server.
Currently replication is automatically set up for read scaling only. For example, if you enable Autoscaling for this Role, and you set the number of minimum instances to 1 and the maximum to 4, then when Scalr detects a load increase above your defined threshold, it will launch a new Server and automatically configure it to be a slave to the master. Hence Server #1 will be the master, and Servers #2, #3, and #4 will be slaves. You can find more information about Server replication by viewing the Scaling section of the Developer Reference.
New slaves that come online are automatically set to read_only to prevent accidental writes from breaking replication, and this setting is automatically removed upon slave2master promotion.
Three different Storage Types are available for your Redis databases. To select your storage for your Redis databases, go to Main Menu > Farms > Select your Farm > Actions Button (rightmost column) > Configure > Click on the Redis Role > Databases Settings.
Once you have chosen your storage type and launched your Farm, you will not be able to change it unless you remove and add the Redis Role again. The following options will appeared grayed out on the Database Settings Tab in the Farm Designer for a selected Role once the Farm has been launched.
The data persists independently from the life of an instance.
The screen shots used in this section are specific to AWS; however, it is important to note that Storage Engine selection names will vary depending on the chosen cloud provider. For example, the Persistent Volumes storage type is referred to as a Persistent Disk in GCE, a Cinder Volume in Rackspace and OpenStack, and as a CloudStack Block Volume in IDCF and CloudStack.
Ephemeral Storage or Instance Store Volumes are ideal for temporary storage of information that changes frequently, such as buffers, caches, scratch data, and other temporary content, or for data that is replicated across a fleet of instances, such as a load-balanced pool of web servers. The data persists only during the life of the associated instance.
Redundant Array of Independent Disks (RAID) is a storage technology that combines multiple disk drive components (persistent volumes) into a logical unit. Data is distributed across the drives in one of several ways called RAID Levels. Scalr allows you to select 4 different RAID levels, the number of volumes you want and their respective size.
|RAID Array Availability|
The RAID Array storage type is not available for every cloud service provider and will only appear if it is a viable option for the provider you are using.
(Deprecated) Service Configuration Presets
This application feature is deprecated and should be skipped unless you are using an earlier version of Scalr.
You can think of Service Configuration presets as configuration file templates. For example if you create a ConfigTemplate, apply it to some of your servers and make a change to the presets, Scalr will automatically merge the preset with the config file, overriding previous values. Scalr is smart enough to know which configuration option modifications require a service restart, and which ones don’t. Services Configurations Presets are available for our Redis Roles. You can learn about this on the (Deprecated) Service Configuration Presets page.
Go to Roles > Service Configuration Presets > Create new (https://my.scalr.net/#/services/configurations/presets/build)
Choose a name and select Redis as a the service
Set the parameters and hit save.
Once you have a ConfigTemplate, you can apply it to your server Farm’s Roles. Go to Server Farms > View All > Select your Farm > Options (rightmost column) > Edit
Select the Redis Role to apply the ConfigTemplate
In the left column, click on Services config and select the template
Hit save and you are done!