How to install Redis Server on Ubuntu 18.04

Methods to set up Redis Server on Ubuntu 18.04

Introduction

The Distant Dictionary Server is greatest suited the place the sturdiness of information shouldn’t be wanted. It has the flexibility to retailer information, referred to as a worth, inside a key.

This information can then be retrieved provided that we all know the precise key used to retailer it. As a result of nature of the database design, typical use instances are as follows:

  • Session caching
  • Full web page cache
  • Message queue functions
  • Leaderboards counting

Particular Observe: Massive firms akin to Twitter, Amazon, and Microsoft are utilizing Redis.

On this tutorial, we present you how one can set up Redis server on Ubuntu 18.04.

Steps

Replace System Packages

 $ sudo apt replace && sudo apt improve

Set up Redis Server Package deal

$ sudo apt set up redis-server

Chances are you’ll need to supervise Redis service in your server. By default, the Redis server has disabled supervised interplay.

Allow Redis supervised interplay by modifying its config file as follows.

$ sudo vim /and so forth/redis/redis.conf

Head on to superviseddirective part as proven under and alter the standing from “no”to “systemd” which is utilized in Ubuntu 18.04. This can will let you handle Redis as a service i.e. begin, restart and verify the standing

# If you happen to run Redis from upstart or systemd, Redis can work together along with your
# supervision tree. Choices:
#   supervised no          - no supervision interplay
#   supervised upstart - sign upstart by placing Redis into SIGSTOP mode
#   supervised systemd - sign systemd by writing READY=1 to $NOTIFY_SOCKET
#   supervised auto        - detect upstart or systemd technique based mostly on
#                            UPSTART_JOB or NOTIFY_SOCKET setting variables# Observe: these supervision strategies solely sign "process is ready."
#           They don't allow steady liveness pings again to your supervisor.
supervised systemd

Save your adjustments and reload the redis service to adapt the brand new adjustments made on the configuration file.

$ sudo systemctl reload redis

Take a look at Redis Server

The Redis service has now been efficiently put in in your server. Now it’s essential take a look at whether or not the service is operating.

READ  Finest Greek Eating places in Melbourne

Verify whether or not the Redis service is operating:

 $ sudo systemctl standing redis

The output ought to be comparable as proven under.

● redis-server.service - Superior key-value retailer
                 Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
                 Lively: lively (operating) since Thu 2018-09-20 19:16:21 UTC; 1 day 1h in the past
                   Docs: http://redis.io/documentation,
                         man:redis-server(1)
                Course of: 5556 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, standing=0/SUCCESS)
                Course of: 5560 ExecStart=/usr/bin/redis-server /and so forth/redis/redis.conf (code=exited, standing=0/SUCCESS)
                Principal PID: 5577 (redis-server)
                  Duties: 4 (restrict: 1152)
                 CGroup: /system.slice/redis-server.service
                         └─5577 /usr/bin/redis-server 127.0.0.1:6379
 
                Sep 20 19:16:21 ubuntu18 systemd[1]: Beginning Superior key-value retailer...
                Sep 20 19:16:21 ubuntu18 systemd[1]: redis-server.service: Cannot open PID file           /var/run/redis/redis-server.pid (but?) after begin: No such file or di
                Sep 20 19:16:21 ubuntu18 systemd[1]: Began Superior key-value retailer.
                strains 1-15/15 (END)

It ought to present you lively (operating) within the third line of the output beginning with “Active”

Carry out the next checks:

1. To check whether or not the server is working, connect with the server and do a ping take a look at to verify its availability.

$ redis-cli
$ 127.0.0.1:6379> ping  PONG

2. We set a random worth to verify whether or not the server will retailer the information persistently.

$ 127.0.0.1:6379> set greetings "Hello World!"  OK

3. To retrieve the worth, we use the next command

$ 127.0.0.1:6379> get greetings  "Hello World!"

4. Exit the server and restart the Redis service. Then verify whether or not the storage is persistent.

$ 127.0.0.1:6379> exit
$ sudo systemctl restart redis
$ redis-cli
$ 127.0.0.1:6379> get greetings  "Hello World!"

Conclusion

The Redis server is just accessible from localhost. It could be essential to configure it to permit connections from different sources ( IP addresses ) and different required configurations. For extra particulars verify our tutorial -How To Configure Redis Server on Ubuntu 18.04

READ  AWS WordPress Internet hosting Prices - 9 AWS Internet hosting Value Situations

Take a look at these high 3 Linux internet hosting providers

Was this text useful?