To get started with Redis Enterprise Cloud Essentials, visit https://redislabs.com/try-redis-modules-for-free and fill out the form:
Once you click “Get Started,” we will send you an email with a link to activate your account and complete your signup process.
For the cloud provider, select Amazon AWS
In the Redis Enterprise Cloud service levels, select the Redis Enterprise Cloud Essentials 30MB/1 Database level and click Create:
Once you create a subscription, you are ready to create a database with modules enabled. As shown below, enter a name for the database you want to create:
Move the toggle to select the module you want. You can choose one module at a time under Redis Enterprise Cloud Essentials. Please note that multiple modules capabilities are currently available only in Redis Cloud Pro.
Let’s go ahead and choose “RediSearch” as our first module. Click “Activate”:
The database will remain in “Pending” status until the process of configuring your new Redis database is completed. When the database is created, you will be able to see all the database settings, including:
RedisInsight is an intuitive and efficient GUI for Redis, allowing you to interact with your databases and manage your data—with built-in support for most popular Redis modules. The free non-commercial add-on provides tools to analyze the memory, profile the performance of your database, and guide you toward better Redis usage.
Learn more about RedisInsight here!
RedisInsight provides built-in support for the RedisJSON, RediSearch, RedisGraph, Redis Streams, and RedisTimeSeries modules to make it even easier to query, visualize, and interactively manipulate search indexes, graphs, streams, and time-series data. Used properly, RedisInsight can make the experience of using modules with Redis Enterprise Cloud Essentials even smoother.
A full-featured desktop GUI client, RedisInsight is available for Windows, macOS, and Linux and is fully compatible with Redis Enterprise. It works with any cloud provider as long as you run it on a host with network access to your cloud-based Redis server. RedisInsight makes it easy to discover cloud databases and configure connection details with a single click. It allows you to automatically add Redis Enterprise Software and Redis Enterprise Cloud databases.
Local installation of RedisInsight:
To use RedisInsight on a local machine, download it for Windows, Mac, or Linux from the RedisInsight page on the RedisLabs website:
Click “Download” to open up a form that allows you to select the operating system of your choice. For example, let’s assume that you want to install RedisInsight on your macOS machine. Choose “Mac OS” as a platform as shown here:
Fill out the rest of the form and click “Download.” Please note that the package name is the combination of the platform and version as shown here:
redisinsight-<platform>-<version>
Click on the RedisInsight executable and install it in your system.
Head over to your web browser and go to http://localhost:8001
You can also run RedisInsight inside Docker containers. Visit https://hub.docker.com/r/redislabs/redisinsight/tags to find the latest Docker image available over DockerHub.
$ docker run -v redisinsight:/db -p 8001:8001 redislabs/redisinsight:latest
Head over to your web browser and go to http://localhost:8001
Congratulations! You have successfully installed RedisInsight and are now ready to inspect your Redis data, monitor database health, and perform runtime server configuration with this browser-based management interface for your Redis deployment.
Once you accept the EULA and click “Confirm,” you are ready to add Redis databases, as shown here:
Select “ADD REDIS DATABASE” and then “Add Database”:
Enter the requested details, including Name, Host (endpoint), Port, and Password in the form, as shown below. You can skip username for now. Then click “ADD REDIS DATABASE”:
Click on the pop-up box to see the RedisInsight dashboard:
Finally, although RedisInsight is a great GUI, sometimes you want to work directly in the command-line interface (CLI). To do so, click “CLI” in the menu on the left side of the RedisInsight UI:
Then paste the appropriate Redis commands in the command section, marked with “>>” as shown below, and press Enter.
You can see the output displayed at the top of the screen. If it says “OK,” the command was executed successfully.
Now that RedisInsight is installed, we’re ready to look at individual Redis modules and see how they work with Redis Enterprise Cloud Essentials.
The following steps use some basic RedisJSON commands. You can run them from the Redis command-line interface (redis-cli) or use the CLI available in RedisInsight. (See part 2 of this tutorial to learn more about using the RedisInsight CLI.)
To interact with RedisJSON, you will most often use the JSON.SET and JSON.GET commands. Before using RedisJSON, you should familiarize yourself with its commands and syntax as detailed in the documentation: RedisJSON Commands.
Learn more about RedisJSON here.
Let’s go ahead and test drive some JSON-specific operations for setting and retrieving a Redis key with a JSON value:
1. Scalar
Under RedisJSON, a key can contain any valid JSON value. It can be scalar, objects or arrays. JSON scalar is basically a string. You will have to use the JSON.SET command to set the JSON value. For new Redis keys the path must be the root, so you will use “.” path in the example below. For existing keys, when the entire path exists, the value that it contains is replaced with the JSON value. Here you will use JSON.SET to set the JSON scalar value to “Hello JSON!” Scalar will contain a string that holds “Hello JSON!”
>> JSON.SET scalar . ' "Hello JSON!" ' "OK"
Use JSON.GET to return the value at path in JSON serialized form:
>> JSON.GET scalar "\"Hello JSON!\""
2. Objects
Let’s look at a JSON object example. A JSON object contains data in the form of a key-value pair. The keys are strings and the values are the JSON types. Keys and values are separated by a colon. Each entry (key-value pair) is separated by a comma. The { (curly brace) represents the JSON object:
{ "employee": { "name": "alpha", "age": 40, "married": true } }
Here is the command to insert JSON data into Redis:
>> JSON.SET employee_profile . '{ "employee": { "name": "alpha", "age": 40,"married": true } } ' "OK"
The subcommands below change the reply’s format and are all set to the empty string by default: * INDENT sets the indentation string for nested levels *. NEWLINE sets the string that’s printed at the end of each line. * SPACE sets the string that’s put between a key and a value:
>> >> JSON.GET employee_profile "{\"employee\":{\"name\":\"alpha\",\"age\":40,\"married\":true}}"
Retrieving a part of JSON document
You can also retrieve a part of the JSON document from Redis. In the example below, “.ans” can be passed in the commandline to retrieve the value 4:
>> JSON.SET object . '{"foo":"bar", "ans":"4" }' "OK" >> JSON.GET object "{\"foo\":\"bar\",\"ans\":\"4\"}" >> JSON.GET object .ans "\"4\""
Retrieving the type of JSON data
JSON.TYPE reports the type of JSON value at path and path defaults to root if not provided. If the key or path do not exist, null is returned.
>> JSON.TYPE employee_profile "Object"
3. JSON arrays of objects
The JSON array represents an ordered list of values. A JSON array can store multiple values, including strings, numbers, or objects. In JSON arrays, values must be separated by a comma. The [ (square bracket) represents the JSON array. Let’s look at a simple JSON array example with four objects:
{"employees":[ {"name":"Alpha", "email":"alpha@gmail.com", "age":23}, {"name":"Beta", "email":"beta@gmail.com", "age":28}, {"name":"Gamma", "email":"gamma@gmail.com", "age":33}, {"name":"Theta", "email":"theta@gmail.com", "age":41} ]} >> JSON.SET testarray . '{"employees":[ {"name":"Alpha", "email":"alpha@gmail.com", "age":23}, {"name":"Beta", "email":"beta@gmail.com", "age":28}, {"name":"Gamma", "email":"gamma@gmail.com", "age":33}, {"name":"Theta", "email":"theta@gmail.com", "age":41} ]} ' "OK" >> JSON.GET testarray "{\"employees\":[{\"name\":\"Alpha\",\"email\":\
\",\"age\":23},{\"name\":\"Beta\",\"email\":\"beta@gmail.com....
4. JSON nested objects
A JSON object can also have another object. Here is a simple example of a JSON object having another object nested in it:
>> JSON.SET employee_info . ' { "firstName": "Alpha", "lastName": "K", "age": 23, "address" : { "streetAddress": "110 Fulbourn Road Cambridge", "city": "San Francisco", "state": "California", "postalCode": "94016" } } ' "OK" >> JSON.GET employee_info "{\"firstName\":\"Alpha\",\"lastName\":\"K\",\"age\":23,\"address\":{\"streetAddress\":\"110 Fulbourn Road Cambridge\",\"city\":\"San Francisco\",\"state\":\"California\",\"postalCode\":\"94016\"}}"
Learn more about RedisJSON in the Quickstart tutorial.