Reader small image

You're reading from  Redis Stack for Application Modernization

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781837638185
Edition1st Edition
Right arrow
Authors (2):
Luigi Fugaro
Luigi Fugaro
author image
Luigi Fugaro

Luigi Fugaro's first encounter with computers was in the early 80s when he was a kid. He started with a Commodore Vic-20, passing through a Sinclair, a Commodore 64, and an Atari ST 1040, where he spent days and nights giving breath mints to Otis. In 1998, he started his career as a webmaster doing HTML, JavaScript, Applets, and some graphics with Paint Shop Pro. He then switched to Delphi, Visual Basic, and then started working on Java projects. He has been developing all kinds of web applications, dealing with backend and frontend frameworks. In 2012, he started working for Red Hat and is now an architect in the EMEA Middleware team. He has authored WildFly Cookbook and Mastering JBoss Enterprise Application Platform 7 by Packt Publishing.
Read more about Luigi Fugaro

Mirko Ortensi
Mirko Ortensi
author image
Mirko Ortensi

Mirko Ortensi earned a degree in Electronic Engineering and a Master's degree in Software Engineering. Mirko's career has spanned several roles from Software Engineering to Customer Support, particularly centered around distributed database systems. As a Senior Technical Enablement Architect at Redis, Mirko shares technical knowledge about Redis's products and services.
Read more about Mirko Ortensi

View More author details
Right arrow

Getting Started with Redis Stack

Redis Stack is a collection of software components that together provide a complete solution for managing data.

As we saw in the previous chapter, Redis Stack is a bundle composed of Redis, plus additional capabilities and data structures. Redis Stack operates under a dual-license framework: the Redis Source Available License (RSALv2) and the Server Side Public License (SSPL). Before Redis Stack was released, each additional data structure and functionality needed to be added separately and activated for each Redis database. Now, everything is integrated and activated by default, easing both the developer and the operational experience.

The Redis Stack community has been focusing on improving the Developer eXperience (DX) for its users. In general, DX refers to the experience of developers as they work with tools, technologies, and platforms to create software. It encompasses everything from the ease of setting up a development environment to...

Installing Redis Stack using binary packages

Redis Stack is source-available software, allowing users to freely access and modify its source code. However, executing the software requires first building it, which can occasionally be complex due to hard-to-find dependencies on system libraries. The simplest way to initiate the software is by obtaining its precompiled binary and executing it. This method is the primary focus of the discussion in this section. However, the complete list of installation options can be found at the following site: https://redis.io/download/#redis-stack-downloads.

Because most of the server environments, either developer local desktop or production, are based on Linux machines, for our example, I’ll use the Ubuntu Focal x86_64 binary:

  1. Let’s start by opening your preferred terminal application and navigating in the filesystem to the path that you want your Redis Stack software to be. In my case, I’m creating a folder called...

Installing Redis Stack using native packages

Different operating systems have their own native package managers that allow you to easily download and install software from a repository of pre-built packages. For example, on Linux, package managers such as APT, YUM, and Pacman are used to manage the installation of software. On macOS, the native package manager is Homebrew, and on Windows, it is Windows Package Manager (WinGet).

To install software using native packages, you simply need to run a command in the command line or use a graphical user interface (GUI) to search for the desired package and initiate the installation process. The package manager will then download the required files and dependencies and install the software on the system.

Using native packages for installation has several advantages over other methods, such as manual installation or downloading from third-party websites. These advantages include the following:

  • Convenience: The installation process...

Using Redis Cloud

In the previous sections, we saw how easy it is to install Redis Stack, but there is another option that is even easier. You can avoid installation entirely, by using Redis Cloud, a service provided by Redis (the company). Redis Cloud can be used as a Database as a Service (DBaaS) on leading cloud providers such as Google Cloud, Azure, and AWS.

The only prerequisite is registering to the Redis portal, at the following link: https://app.redislabs.com/.

Once registered, you can start configuring the size of your Redis Stack database in a few seconds, as follows:

Figure 3.2 – Redis Cloud

Figure 3.2 – Redis Cloud

Once configured, Redis Cloud will provide the endpoint of your Redis Stack database, which is accessible with the credentials you provided, as depicted in the following figure:

Figure 3.2 – Redis Cloud database endpoint

Figure 3.2 – Redis Cloud database endpoint

Overall, the fully managed service offers an easy and convenient way to use Redis Stack...

Installing RedisInsight

RedisInsight is designed with a strong focus on developer experience. Its web-based interface is intuitive and user-friendly, providing a visual way for developers and database administrators to interact with Redis instances.

RedisInsight can be downloaded from the following link: https://redis.com/redis-enterprise/redis-insight/.

Installation packages are provided for Linux, Windows, and macOS.

The tool provides real-time monitoring and debugging capabilities, allowing developers to quickly identify and resolve issues in Redis databases. It also includes a number of features designed to simplify common Redis tasks, such as adding and modifying Redis keys and executing Redis commands and scripts.

Figure 3.3 – RedisInsight

Figure 3.3 – RedisInsight

Overall, RedisInsight’s focus on the developer experience makes it a valuable tool for any team working with Redis. By providing a simple and intuitive interface, as well as powerful monitoring...

Installing the Redis Stack client libraries

Redis Stack is based on Redis, which means it uses the same protocol, REdis Serialization Protocol (RESP). Therefore, all the Redis client libraries available are also valid for Redis Stack.

Here is a list of the supported client libraries:

  • jedis: The Java client library supported by Redis and its community
  • node-redis: The JavaScript client library supported by Redis and its community
  • redis-py: The Python client library supported by Redis and its community
  • go-redis: The Golang client library supported by Redis and its community
  • NRedisStack: The C#/.NET client library supported by Redis and its community

In this section, we will see how to import those libraries into your code.

Java client library

To use the jedis library, it has to be imported and declared as a dependency in your code.

For Maven-based projects, you can use the following code snippet:

<dependency>
    ...

Running health checks

Redis is a powerful, yet simple-to-use, open source data structure server that is designed for high performance and scalability. One of the core principles behind Redis is simplicity, which is reflected both in its design and its architecture. And the question “Is my Redis ready?” finds its answer in the redis-cli tool.

Verifying whether the installation has been completed correctly is as simple as running the following command in a terminal window:

redis-cli –h 127.0.0.1 -p 6379 PING
PONG

This is the most reliable and secure way to check whether Redis is up and running. If it is, a PONG response message will be given. Failing that, an alternative message will be reported, as follows:

redis-cli –h 127.0.0.1 -p 6379 PING
LOADING Redis is loading the dataset in memory

Automating the health check for Redis is possible using the redis-cli executable. This means that scripts can be written to interpret the output message from...

Summary

In this chapter, we have conducted a comprehensive review of the various techniques for installing Redis Stack, encompassing the use of binaries, native packages, and Docker. Additionally, we delved into the process of optimizing the development experience by installing RedisInsight, a GUI, alongside client libraries suitable for different programming languages. Moreover, we addressed the crucial topic of running Redis health checks in a straightforward and dependable manner. It is our expectation that after studying this chapter, you will possess a sound understanding of the procedures involved in installing Redis, and that you will be equipped with the knowledge and tools necessary for monitoring its health to ensure the smooth and uninterrupted functioning of Redis Stack.

In Chapter 4, Setting Up Client Libraries, we will focus on the developer experience by building projects for each Redis-supported client library, and we will start coding some examples using the Redis...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Redis Stack for Application Modernization
Published in: Dec 2023Publisher: PacktISBN-13: 9781837638185
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Luigi Fugaro

Luigi Fugaro's first encounter with computers was in the early 80s when he was a kid. He started with a Commodore Vic-20, passing through a Sinclair, a Commodore 64, and an Atari ST 1040, where he spent days and nights giving breath mints to Otis. In 1998, he started his career as a webmaster doing HTML, JavaScript, Applets, and some graphics with Paint Shop Pro. He then switched to Delphi, Visual Basic, and then started working on Java projects. He has been developing all kinds of web applications, dealing with backend and frontend frameworks. In 2012, he started working for Red Hat and is now an architect in the EMEA Middleware team. He has authored WildFly Cookbook and Mastering JBoss Enterprise Application Platform 7 by Packt Publishing.
Read more about Luigi Fugaro

author image
Mirko Ortensi

Mirko Ortensi earned a degree in Electronic Engineering and a Master's degree in Software Engineering. Mirko's career has spanned several roles from Software Engineering to Customer Support, particularly centered around distributed database systems. As a Senior Technical Enablement Architect at Redis, Mirko shares technical knowledge about Redis's products and services.
Read more about Mirko Ortensi