Post

Redis_GitCommands

✅ Install

First, brew has to be installed

1
2
// brew 버전 확인
brew --version
1
2
3
4
5
6
7
8
// redis 설치
brew install redis

// redis 설치 제거
brew uninstall redis

// redis 버전 확인
redis-server --version

✅ Run Redis on ForeGround

🔴 This will not allow other works to be run on terminal

1
2
// redis foreground로 실행
redis-server

✅ Run Redis on BackGround

1
2
3
4
5
6
7
8
// redis background로 실행
brew services start redis

// redis background로 재실행
brew services restart redis

// redis background로 중지
brew services stop redis

redis 실행 상태 확인

1
2
// redis 실행 상태 확인
brew services info redis

✅ Terminate Redis running on port 6379

1
2
3
4
5
6
-- open new tab
-- connect to the Redis server:
redis-cli

-- 끄기
SHUTDOWN

✅ Redis CLI

Redis CLI(Command Line Interface)는 Redis 명령어 라인 인터페이스입니다. 즉, Redis를 사용하기 위해 제공되는 Redis 명령어입니다. 해당 명령어를 이용하여 Redis에 값을 쓰고, 조회하고, 삭제할 수 있습니다.

Redis CLI 사용

1
2
// redis-cli 사용
redis-cli

데이터 생성, 수정

1
2
3
4
// redis 데이터 생성, 수정(같은 key값이 존재하면 데이터만 업데이트됨)
// set {key} {value}
// set {키 이름} {내가 입력하고 싶은 값}
set mykey myvalue

데이터 조회

1
2
3
// redis 데이터 조회
// get {key}
get mykey

Key 목록 조회

1
keys *

Key 수정

1
2
// rename {기존키} {변경키}
rename mykey mykey2

Key 개수 조회

1
dbsize

Key(데이터) 삭제

1
2
// del {key}
del mykey2

Key(데이터) 전체 삭제

1
flushall
This post is licensed under CC BY 4.0 by the author.