본문 바로가기
기타

[Redis] Redis 설치 Mac OS

by Rapil 2023. 7. 21.

 

오늘은 Mac에서 Redis(레디스) 설치하기입니다.

 


Point

Redis 설치

Redis 실행

Redis 상태 확인

Redis CLI를 이용하여 사용하기

 

 

Redis 설치(Mac OS)

 

// Hombrew로 설치 여부 확인
$ brew --version

// Redis 설치
$ brew install redis

// Redis 설치 제거 (Redis를 제거하고 싶을 시 명령어 실행)
$ brew uninstall redis
 

 

Redis 실행 (Mac OS)

 

// Redis 실행
$ redis-server
 
 
실행 시 위의 이미지와 같이 redis가 port 6379에 실행되고 있다고 출력됩니다.

 

* Redis Background 실행하기

// Redis Background 실행
$ brew services start redis

// Redis Background 재실행
$ brew services restart redis

// Redis Background 중지
$ brew services stop redis
 

 

Redis 상태 확인

 

 // Redis 실행 상태 확인
brew service
 

 

 

Redis CLI를 이용하여 사용하기

 

Redis CLI(Command Line Interface) - Redis를 사용하기 위해 제공되는 명령어입니다

명령어를 이용해 Redis에 값을 쓰기, 조회하기, 삭제를 할 수 있습니다.

 

// Redis-cli 사용
$ redis-cli

// Redis 데이터 생성, 수정
// 예) set testkey testvalue
$ set [key] [value]

// Redis 데이터 조회
// 예) get testkey
$ get [key]

// Redis 데이터 key 목록 조회
$ keys *

// Redis key 수정
// 예) redis testkey testkey2
$ rename [기존키] [변경키]

// Redis key 개수 조회
$ dbsize

// Redis key 삭제
// 예) del testkey2
$ del [key]

// Redis key 전체 삭제
$ flushall
 

 


오늘은 Redis에 대해서 배웠습니다

하나씩 배워나가면서 채워가는 재미를 느끼시길 바라면서!

모두 파이팅입니다!


 

참고 URL :

 

https://wlswoo.tistory.com/44