Deploy Redis to your local

Below steps are running on MacOS. It might now work if you're using Windows OS.

Run redis docker image

>> docker run --rm -ti --name test-redis -p 6379:6379 redis:6.2-rc3-alpine

1:C 20 Feb 2021 19:39:26.881 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 20 Feb 2021 19:39:26.881 # Redis version=6.1.242, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 20 Feb 2021 19:39:26.881 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 20 Feb 2021 19:39:26.883 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.1.242 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

1:M 20 Feb 2021 19:39:26.885 # Server initialized
1:M 20 Feb 2021 19:39:26.885 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memor
y = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 20 Feb 2021 19:39:26.885 * Ready to accept connections

Check running container

Attach another processor to open console in the container

Enter redis-cli and test

Test using netcat from your local terminal

Ref: https://stackoverflow.com/a/33246275/3117474

Test using Java

Import Redis Java driver using maven

https://mvnrepository.com/artifact/redis.clients/jedis

Sample Java program

Last updated

Was this helpful?