You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
899 B
Markdown
51 lines
899 B
Markdown
# Setup Redis server on Docker
|
|
|
|
1. Start docker
|
|
|
|
```
|
|
$ docker-composer up -d
|
|
```
|
|
|
|
2. to enter CLI
|
|
|
|
```
|
|
// check image name
|
|
$ docker ps
|
|
|
|
// enter interactive shell
|
|
$ docker exec -it razer-redis_redis_1 redis-cli
|
|
|
|
```
|
|
|
|
3. Test redis connectivity. [Reference](https://redis.io/topics/rediscli)
|
|
|
|
```
|
|
$ sudo apt install redis-tools
|
|
|
|
// default : localhost:6379
|
|
$ redis-cli incr mycounter
|
|
(integer) 1
|
|
|
|
// test ping using address
|
|
$ redis-cli -h server1.razer.org -p 6379 -a <password> ping
|
|
PONG
|
|
|
|
// or
|
|
|
|
$ redis-cli -u redis://p%40ssw0rd@redis-16379.hosted.com:16379/0 ping
|
|
|
|
$ redis-cli --stat
|
|
|
|
$ redis-cli monitor
|
|
|
|
// publish message to queue
|
|
$ curl -u admin:admin -d "body=order_id" http://localhost:8161/api/message/shop?type=queue
|
|
|
|
// publish message to topis
|
|
$ curl -u admin:admin -d "body=order_id” http://localhost:8161/api/message/shop?type=topic
|
|
```
|
|
|
|
4. Stop server
|
|
```
|
|
$ docker-compose down
|
|
``` |