Centos7 레디스 설치하기

1. 우선 레디스를 설치 하기 앞서서 시스템을 업데이트 해줍니다.

sudo yum -y update

 

2. REMI repisitory 을 추가 해줍니다.

sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

 

3. Centos7에 레디스를 설치합니다.

$ sudo yum --enablerepo=remi install redis
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
base: centos.mirrors.proxad.net
epel: mirrors.ircam.fr
extras: centos.crazyfrogs.org
remi: remi.mirror.ate.info
remi-php72: remi.mirror.ate.info
remi-safe: remi.mirror.ate.info
updates: centos.quelquesmots.fr
rabbitmq_rabbitmq-server/x86_64/signature                                                                                       |  836 B  00:00:00     
rabbitmq_rabbitmq-server/x86_64/signature                                                                                       | 1.0 kB  00:00:00 !!! 
rabbitmq_rabbitmq-server-source/signature                                                                                       |  836 B  00:00:00     
rabbitmq_rabbitmq-server-source/signature                                                                                       | 1.0 kB  00:00:00 !!! 
Resolving Dependencies
--> Running transaction check
---> Package redis.x86_64 0:5.0.3-1.el7.remi will be installed
--> Finished Dependency Resolution 
Dependencies Resolved
=======================================================================================================================================================
Package                          Arch                              Version                                      Repository                       Size
Installing:
redis                            x86_64                            5.0.3-1.el7.remi                             remi                            919 k
Transaction Summary
Install  1 Package
Total download size: 919 k
Installed size: 3.0 M
Is this ok [y/d/N]: y
Downloading packages:
redis-5.0.3-1.el7.remi.x86_64.rpm                                                                                               | 919 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : redis-5.0.3-1.el7.remi.x86_64                                                                                                       1/1 
Verifying  : redis-5.0.3-1.el7.remi.x86_64                                                                                                       1/1 
Installed:
redis.x86_64 0:5.0.3-1.el7.remi                                                                                                                      
Complete!

 

4. 설치한 패키지에 대해서 rpm -qi redis 명령어를 치면 자세히 볼 수 있습니다. 

$ rpm -qi redis 
 Name        : redis
 Version     : 5.0.3
 Release     : 1.el7.remi
 Architecture: x86_64
 Install Date: Thu 10 Jan 2019 05:02:04 PM EAT
 Group       : Applications/Databases
 Size        : 3155665
 License     : BSD
 Signature   : DSA/SHA1, Wed 12 Dec 2018 04:44:08 PM EAT, Key ID 004e6f4700f97f56
 Source RPM  : redis-5.0.3-1.el7.remi.src.rpm
 Build Date  : Wed 12 Dec 2018 04:42:35 PM EAT
 Build Host  : builder.remirepo.net
 Relocations : (not relocatable)
 Packager    : https://blog.remirepo.net/
 Vendor      : Remi Collet
 URL         : http://redis.io
 Bug URL     : https://forum.remirepo.net/
 Summary     : A persistent key-value database
 Description :
 Redis is an advanced key-value store. It is often referred to as a data
 structure server since keys can contain strings, hashes, lists, sets and
 sorted sets.
 You can run atomic operations on these types, like appending to a string;
 incrementing the value in a hash; pushing to a list; computing set
 intersection, union and difference; or getting the member with highest
 ranking in a sorted set.
 In order to achieve its outstanding performance, Redis works with an
 in-memory dataset. Depending on your use case, you can persist it either
 by dumping the dataset to disk every once in a while, or by appending
 each command to a log.
 Redis also supports trivial-to-setup master-slave replication, with very
 fast non-blocking first synchronization, auto-reconnection on net split
 and so forth.
 Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
 limited time-to-live, and configuration settings to make Redis behave like
 a cache.
 You can use Redis from most programming languages also.

 

5. 설치가 완료 되었다면 레디스를 실행시킵니다.

sudo systemctl enable --now redis

 

6. 레디스 설정을 선택적으로 해줍니다.

sudo vim /etc/redis.conf
Example:

bind 192.168.0.101  
requirepass kabby91  
appendonly yes

 

7.설정을 한 뒤 레디스를 재시작 해줍니다.

sudo systemctl restart redis

 

8. 레디스가 올라온 상태를 체크해줍니다.

$ sudo systemctl status redis  
● redis.service - Redis persistent key-value database  
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)  
Drop-In: /etc/systemd/system/redis.service.d  
└─limit.conf  
Active: active (running) since Tue 2018-12-04 15:23:08 UTC; 3s ago  
Process: 3625 ExecStop=/usr/libexec/redis-shutdown (code=exited, status=0/SUCCESS)  
Main PID: 3640 (redis-server)  
CGroup: /system.slice/redis.service  
└─3640 /usr/bin/redis-server 0.0.0.0:6379  
Dec 04 15:23:08 cent-01 systemd\[1\]: Starting Redis persistent key-value database...  
Dec 04 15:23:08 cent-01 systemd\[1\]: Started Redis persistent key-value database.

 

9. 레디스 서버에 연결이 잘되는지 테스트를 합니다.

$ redis-cli  
127.0.0.1:6379>

127.0.0.1:6379> AUTH kabby91  
OK

127.0.0.1:6379> INFO Server

# Server

redis\_version:3.2.12  
redis\_git\_sha1:00000000  
redis\_git\_dirty:0  
redis\_build\_id:7897e7d0e13773f  
redis\_mode:standalone  
os:Linux 3.10.0-862.14.4.el7.x86\_64 x86\_64  
arch\_bits:64  
multiplexing\_api:epoll  
gcc\_version:4.8.5  
process\_id:3640  
run\_id:ef36ca5ae9d561d8d3d3ea979cc8481eab0da874  
tcp\_port:6379  
uptime\_in\_seconds:145  
uptime\_in\_days:0  
hz:10  
lru\_clock:433261  
executable:/usr/bin/redis-server  
config\_file:/etc/redis.conf  

 

'IT > Infra' 카테고리의 다른 글

[Docker] MinIO 객체 스토리지  (0) 2020.08.05
[Mac] MinIO 객체 스토리지  (0) 2020.08.01
[Centos7] maven 설치하기  (0) 2020.01.08
도커(Docker) : 맥(Mac)으로 도커 설치하기  (0) 2019.12.16
[Centos7] Git 설치  (0) 2019.12.12

+ Recent posts