Redis Client Install Mac

Installing redis under Linux
Introduction and use of redis
Introduction and installation of redis framework (MAC and windows)

Redis installation and use

Manual download of PPM modules. Note that although this page shows the status of all builds of this package in PPM, including those available with the free Community Edition of ActivePerl, manually downloading modules (ppmx package files) is possible only with a Business Edition license.

RDM offers you an easy-to-use GUI to access your Redis ® databases and perform some basic operations:. View keys as a tree; CRUD keys; Analyse memory usage for entire DB or for selected namespace in tree-view (Redis ® = 4.0 is required); List connected clients. Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication. Fast A single Celery process can process millions of tasks a minute, with sub-millisecond round-trip latency (using RabbitMQ, py-librabbitmq, and optimized settings). Brew install Redis on Mac Raw. Mac-setup-redis.md type below: brew update brew install redis To have launchd start redis now and restart at login: brew services start. Initiate the interactive shell within the my-second-redis container: sudo docker exec -it my-second-redis sh. Start the Redis command-line in the my-second-redis container and connect to my-first-redis (now named redis), with the following command: # redis-cli -h redis. The original my-first-redis container is still active.

Redis introduction

Our daily development, data need to be persistent storage, common persistent storage has many kinds, such as database, file, computer memory, and even cloud server are persistent storage of data. As far as database is concerned, it is often divided into relational database and non relational database. In our project, the relational database we use is mysql, the data stored in the relational database is mainly some core business data; in addition, in our project, there are some data that are unlikely to change, such as the regional data in the application, city list, or the statistics of the increase in the number of applications every day, and so on. These data are very important for us The requirement of timeliness is not particularly high. Therefore, in order to improve the storage efficiency of the application and improve the performance of the program, we will store some data that do not change obviously and often in the redis database.

So why can storage efficiency be improved by putting it in redis database? Redis database is a kind of non relational database, and its storage form is key value format. There are many ways to support it, such as memory, disk, file and so on. The characteristic of key value database is that it can locate the corresponding value directly according to the key. Therefore, compared with the table structure query method of relational database, the non relational database has very high execution efficiency, and we usually store the data in memory, and the speed of memory reading and writing is the fastest. Therefore, it can meet our needs of high traffic and high concurrency.

Redis database installation

  • MAC system
    Install brew first

1.brew install redis
2. Set redis server as an environment variable
vim .bash_profile
alias redis=/usr/local/Cellar/redis/5.0.0/bin/redis-server
Note: modify the configuration file and path to your own configuration
3. Execute redis and start redis service

  • Windows system

1. Download redis:https://github.com/MicrosoftArchive/redis/releases (or see the compressed package file)
2. The downloaded files are MSI files that can be installed and run directly
3. Click MSI file, and the steps are as follows:
Waiting for installation

1) First, find the installation directory where you want to install redis
2) Open the CMD terminal and enter the redis installation directory:
3) Execute redis- cli.exe The documents are as follows:
The above screen appears, indicating that the installation is successful.

  • Enter the redis terminal:redis-cli

This work adoptsCC agreementReprint must indicate the author and the link of this article

In this article, I will explain how to secure your Redis databases using SSL (Secure Sockets Layer). In production, it is a good practice to use SSL to protect the data that are moving between various computers (client applications and Redis servers). Transport Level Security (TLS) guarantees that only allowed applications/computers are connected to the database, and also that data is not viewed or altered by a middle man process.

You can secure the connections between your client applications and Redis cluster using:

  • One-Way SSL: the client (your application) get the certificate from the server (Redis cluster), validate it, and then all communications are encrypted
  • Two-Way SSL: (aka mutual SSL) here both the client and the server authenticate each other and validate that both ends are trusted.

In this article, I will focus on the Two-Way SSL, and using Redis Enterprise.

Prerequisites:

  • A Redis Enterprise 5.4.x database, (my database is protected by the password secretdb01, and listening on port 12000)
  • redis-cli to run basic commands
  • Python, Node, and Java installed if you want to test various languages.
Install

Simple Test

Let’s make sure that the database is available:

This should print the Server information.

1- Get the Certificate from Redis Cluster

You have access to the Redis Enterprise Cluster, you go to one of the nodes to retrieve the certificate (that is a self-generated one by default).

Install

The cluster certificate is located at: /etc/opt/redislabs/proxy_cert.pem.

You have to copy it on each client machine; note that once it is done you can use this certificate to connect using “One-Way SSL”, but not the purpose of this article.

In my demonstration I am using Docker and copy the certificate using this command from my host:

2- Generate a New Client Certificate

Using the Two-Way SSL you need to have a certificate for the client that will be used by Redis database proxy to trust the client.

In this article I will use a self-signed certificate using OpenSSL, in this example, we are creating a certificate for an application named app_001.

You can create as many certificates as you want, or reuse this one for all servers/applications.

Open a terminal and run the following commands:

This command generate a new client key (client_key_001.pem) and certificate (client_cert_001.pem) with no passphrase.

3- Configure the Redis Database

The next step is to take the certificate and add it to the database you want to protect.

Let’s copy the certificate and paste it into the Redis Enterprise Web Console.

Copy the certificate in your clipboard:

Mac:

Linux:

Windows:

Go to the Redis Enterprise Admin Web Console and enable TLS on your database:

  1. Edit the database configuration
  2. Check TLS
  3. Select “Require TLS for All communications”
  4. Check “Enforce client authentication”
  5. Paste the certificate in the text area
  6. Click the Save button to save the certificate
  7. Click the Update button to save the configuration.

The database is now protected, and it is mandatory to use the SSL certificate to connect to it.

4- Connect to the Database using the Certificate

In all following examples, I am using a “self-signed” certificate, so I do not check the validity of the hostname.You should adapt the connections/TLS information based on your certificate configuration.

4.1 Using Redis-CLI

To connect to a SSL protected database using redis-cli you have to use stunnel.

Create a stunnel.conf file with the following content:

Start stunnel using the command

This will start a process that listen to port 6380 and used as a proxy to the Redis Enterprise database on port 12000.

4.2 Using Python

Using Python, you have to set the SSL connection parameters:

More information in the documentation “Using Redis with Python”.

4.3 Using Node.JS

For Node Redis, use the TLS library to configure the client connection:

More information in the documentation “Using Redis with Node.js”.

4.4 Using Java

In Java, to be able to connect using SSL, you have to install all the certificates in the Java environment using the keytool utility.

Create a keystore file that stores the key and certificate you have created earlier:

As you can see the keystore is used to store the credentials associated with you client; it will be used later with the -javax.net.ssl.keyStore system property in the Java application.

In addition to the keys tore, you also have to create a trust store, that is used to store other credentials for example in our case the redis cluster certificate.

Create a trust store file and add the Redis cluster certificate to it

The trustore will be used later with the -javax.net.ssl.trustStore system property in the Java application.

You can now run the Java application with the following environment variables:

For this example and simplicity, I will hard code these property in the Java code itself:

  • line 8-12, the system environment variables are set to point to the keystore and trust store (this should be externalized)
  • line 14, the Redis URL start with rediss with 2 s to indicate that the connection should be encrypted
  • line 17, set the database password

More information in the documentation “Using Redis with Java”.

Conclusion

Redis Client Install Mac 10.13

In this article, you have learned how to:

Redis Server Mac

  • retrieve the Redis Server certificate
  • generate a client certificate
  • protect your database to enforce transport level security (TLS) with 2 ways authentication
  • connect to the database from redis-cli, Python, Node and Java

Comments are closed.