Developing

Redis-Cli Local환경에서 JSON.GET/PUT 사용가능하게 하는 법(Err unknown command 'JSON.GET' with args beginning 해결방법) 본문

Trouble Shooting

Redis-Cli Local환경에서 JSON.GET/PUT 사용가능하게 하는 법(Err unknown command 'JSON.GET' with args beginning 해결방법)

DEV_BLOG 2023. 7. 11. 22:09

Elastic Cache Redis Cluster 환경에서는 redis-cli에서 JSON.GET/PUT 명령어를 사용할 수 있지만 local 환경에서는 별도의 조치를 취해야한다. RedisJSON Github을 참조해보면 Rust Install -> cargo build 하는 방법과 Docker를 활용하는 방법이 기재되어있다.

 

Docker를 활용하는 방법이 가장 쉽고 빠른길이기에 관련 포스팅을 하고자한다.

 

 

#Mac환경일때 Case : redis Port가 충돌하지 않게 redis-server를 우선 종료해주자.
#brew services stop redis

#Docker Image Pull
docker pull redis/redis-stack:latest

#Docker Run Container
docker run -p 6379:6379 --name redis-stack redis/redis-stack:latest

 

 

 

 

 

JSON.GET Command를 실행하였을때 Docker Container를 실행해주면

 

ERR unknown command 'JSON.GET', with args beginning with:

-> ERR wrong number of arguments for 'JSON.GET' command 문구로 바뀐 것을 확인할 수 있다. 이제 Redis JSON 명령어를 자유자재로 사용할 수 있게되었다.

 

 

local redis-cli 환경에서도 정상적으로 redisJSON Command가 사용가능해졌다.

 

 

 

RedisJson 문법은 aws 공식문서에도 나와있다.

https://docs.aws.amazon.com/ko_kr/AmazonElastiCache/latest/red-ug/json-list-commands.html

 

지원되는 Redis JSON 명령 - Amazon ElastiCache for Redis

이 페이지에 작업이 필요하다는 점을 알려 주셔서 감사합니다. 실망시켜 드려 죄송합니다. 잠깐 시간을 내어 설명서를 향상시킬 수 있는 방법에 대해 말씀해 주십시오.

docs.aws.amazon.com

 

 

 

Reference

https://github.com/RedisJSON/RedisJSON

 

GitHub - RedisJSON/RedisJSON: RedisJSON - a JSON data type for Redis

RedisJSON - a JSON data type for Redis. Contribute to RedisJSON/RedisJSON development by creating an account on GitHub.

github.com