Skip to content

Split View: Ubuntu에 Redis DB install guide

|

Ubuntu에 Redis DB install guide

Redis 소개

Redis 란, memory에 데이터를 보관하는 no-SQL 진영의 in-memory Data Base 이다. 고가용성을 제공하고, Clustering 을 통해 확장도 가능하다.

install Redis

ubuntu에서 redis를 standalone 으로 설치하는 법은 굉장히 간단하다.

sudo apt install redis-server

version 확인

apt 패키지 매니져로 설치할 경우, Redis 6.0.16 version이 설치된다.

redis-server --version
Redis server v=6.0.16 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=a3fdef44459b3ad6

port 확인

Redis는 기본적으로 6379 port를 사용한다.

netstat -nlpt | grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      15184/redis-server

redis-cli

redis-cli 명령어를 입력하면, redis를 cli에서 control 할 수 있는 shell 어플리케이션이 실행된다.

$ redis-cli
127.0.0.1:6379> help
redis-cli 6.0.16
To get help about Redis commands type:
      "help @<group>" to get a list of commands in <group>
      "help <command>" for help on <command>
      "help <tab>" to get a list of possible help topics
      "quit" to exit

명령어는 굉장히 간단하다. set을 통해, key 에 해당하는 value를 저장할 수 있고, get을 통해 지정한 key의 value 데이터를 가져올 수 있다. del 명령어를 통해 지정한 key의 data를 삭제할 수 있다.

redis-cli
127.0.0.1:6379> set name testname
OK
127.0.0.1:6379> get name
"testname"
127.0.0.1:6379> keys *
1) "name"
127.0.0.1:6379> del name
(integer) 1
127.0.0.1:6379> keys *
(empty array)

Redis DB Installation Guide on Ubuntu

Introduction to Redis

Redis is an in-memory database in the NoSQL family that stores data in memory. It provides high availability and can be scaled through clustering.

Install Redis

Installing Redis as a standalone instance on Ubuntu is very straightforward.

sudo apt install redis-server

Check Version

When installed via the apt package manager, Redis version 6.0.16 is installed.

redis-server --version
Redis server v=6.0.16 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=a3fdef44459b3ad6

Check Port

Redis uses port 6379 by default.

netstat -nlpt | grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      15184/redis-server

redis-cli

Entering the redis-cli command launches a shell application that allows you to control Redis from the CLI.

$ redis-cli
127.0.0.1:6379> help
redis-cli 6.0.16
To get help about Redis commands type:
      "help @<group>" to get a list of commands in <group>
      "help <command>" for help on <command>
      "help <tab>" to get a list of possible help topics
      "quit" to exit

The commands are very simple. You can store a value for a given key using set, and retrieve the value of a specified key using get. You can delete data for a specified key using the del command.

redis-cli
127.0.0.1:6379> set name testname
OK
127.0.0.1:6379> get name
"testname"
127.0.0.1:6379> keys *
1) "name"
127.0.0.1:6379> del name
(integer) 1
127.0.0.1:6379> keys *
(empty array)

Quiz

Q1: What is the main topic covered in "Redis DB Installation Guide on Ubuntu"? Learn how to install Redis DB on Ubuntu.

Q2: What is Check Version? When installed via the apt package manager, Redis version 6.0.16 is installed.

Q3: Explain the core concept of Check Port. Redis uses port 6379 by default. redis-cli Entering the redis-cli command launches a shell application that allows you to control Redis from the CLI. The commands are very simple.