Company Blog

Getting started with RLEC – How to Create and Configure a Database

Getting started with RLEC - How to Create and Configure a Database

Posts in this series:

  1. Introduction to Redis Labs Enterprise Cluster (RLEC)
  2. Getting started with RLEC – How to Install and Setup
  3. Getting started with RLEC – Installing on AWS Cloud
  4. Getting started with RLEC – How to Create and Configure a Database
  5. Getting Started with RLEC – Viewing Graphs & Metrics

After you’ve got your RLEC environment up and running (see the links above to my previous posts), you are ready to create your databases.

To create a database, you need to click on the Databases option in the menu. If you do not have any databases yet, you will be immediately prompted to create a new Redis or Memcached database, as shown in the screenshot below:

Add a new database

Otherwise, you will be able to see an overview of all your existing databases. To create a new database, you should click on the ‘+‘ (plus) button at the bottom of the page here:

Databases page

After choosing the type of database you want (Redis or Memcached – I chose Redis for this example), you’ll be shown the new database screen, as seen below:

New database - simple

The only mandatory fields here are your database “Name” and “Memory limit”. After setting the values of these two fields, you can click on the Activate button at the bottom of the page to create the database. Quick and simple — your database is now ready!

For the purposes of this example, I will click on Show advanced options at the bottom of the page to expand all the available options, as shown in the screenshot below:

New database - advanced

Let’s quickly review these different database configuration fields:

  • Name – A user-friendly identifier for the database.
  • Memory limit – The total size, in GB, allocated to this database. Once you set the memory limit, RLEC makes sure that no matter how the database is configured, the overall size of the database in the cluster will not go above this memory limit. For example, if you choose to enable replication (more details below), the actual dataset size you can store in this database will be half the size of the memory limit because RLEC keeps a copy of the data for high-availability purposes. You can read more in the database memory limit section of our documentation.
  • Replication – You should enable replication if you would like to ensure high-availability for this database. When you enable replication, RLEC keeps a copy of the data so if there is some failure in the master copy, it will trigger instantaneous failover and you will not lose any data or database availability. You can read more in the database replication section of our documentation.
  • Rack-zone awareness – When the cluster is configured for rack-zone awareness, and you activate this feature at the database level, RLEC ensures more sophisticated high-availability by placing the master copy and the slave copy of the data on nodes that are in different racks (or zones). By doing this, high-availability is guaranteed even if an entire rack goes down. You can read more in the rack-zone awareness section of our documentation.
  • Data persistence – If you’d like the data to also be persisted to disk, you can choose which persistence option you would like to use. The two basic persistence options are Snapshot to RDB file, or AOF (Append Only File) every 1 second. For snapshot, you can choose between every hour, every 6 hours, or every 12 hours. RLEC includes an optimization mechanism in which AOF persistence (on a database with replication enabled) is done using the slave’s copy of the data. This ensures that database performance is not impacted by the AOF persistence. You can read more about Redis persistence and the differences between Snapshot and AOF in the Redis documentation.
  • Redis password – If you would like to secure access to your database using a password, you can set the password in this field. Then any client that would like to connect to the database endpoint would have to supply this password.
  • Endpoint port number – By default, RLEC assigns a random port number from within a certain range for the database endpoint. If you would like to use a specific port number instead, you can assign it in this field when initially creating the database. Once the port number has been assigned it cannot be modified.
  • Database clustering – RLEC enables you to easily break your database into multiple shards, and then splits the dataset into these shards. This enables you to scale your database on a single machine and take advantage of multiple CPU cores (as Redis is single threaded…), as well as scale your database across multiple machines by placing database shards on different nodes. You can decide on the number of shards you would like the database to have, as well as your sharding policy. For the sharding policy, you can choose between the Standard sharding policy or the Custom sharding policy, which allows you to define a set of RegEx (regular expression) rules by which RLEC will split the data into shards. You can read more in the Database clustering section of the documentation.
  • Data eviction policy – Redis supports different types of eviction policies that are used when the database reaches its memory limit. You can read more in the Database eviction policy section of our documentation, or the Redis documentation.
  • Replica of – This feature enables you to define this database as a replica (destination) of one or more databases (sources). Once this is defined and your initial data load is completed, all write commands will be synchronized from the sources to the destination. This enables you to keep a database (destination) that is an exact replica of multiple other databases. The source databases can reside within the same RLEC, a different RLEC, or a standalone Redis instance. This can be very useful, for example, if you would like to distribute the read load of your application across multiple databases. Or it can be used to do a one-time synchronization of a database (either within RLEC or external to RLEC) to a database in RLEC. You can read more in the Replica of section of our documentation.
  • Periodic backup – This enables you to keep a backup of your database to external storage. You can choose to backup every 4, 12, or 24 hours, to various locations such as: FTP, AWS S3, OpenStack Swift, etc.
  • Alerts – There are various database-related KPIs that you can receive notifications on. You can choose which alerts are of interest to you, set a custom threshold where relevant, and indicate whether you would like to receive the alerts by email, in the management UI, or both.

Once you have configured the database with your settings, you can click Activate and after a few seconds you will have your database up and running and be able to see the database endpoint that you can use to connect to the database. See example below:

View database

That’s it, now you know how to create a database with all the advanced options RLEC has to offer!

In the next post I will review different graphs and metrics related to the cluster, nodes, database, and database shards.

If you would like to learn more about RLEC and how to enable advanced functionality, please refer to the documentation that can be found here: https://redislabs.com/redis-enterprise-documentation/overview

If you have any feedback or questions, please don’t hesitate to reach out to me at itai.raz@redislabs.com.

Subscribe

Get the latest Blog posts by email.