Redis: Difference between revisions
Jump to navigation
Jump to search
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Web sites = | = Web sites = | ||
* https://redis.io/ | * https://redis.io/ | ||
** https://redis.io/topics/quickstart | |||
* https://en.wikipedia.org/wiki/Redis | * https://en.wikipedia.org/wiki/Redis | ||
* [https://dzone.com/articles/10-traits-of-redis 10 Advantages of Redis]. Redis has a small memory footprint and it can be installed in Raspberry Pi to enable IoT-based applications. | |||
* [https://www.tutorialspoint.com/redis/redis_overview.htm Redis Advantages] | |||
* [http://highscalability.com/blog/2019/9/3/top-redis-use-cases-by-core-data-structure-types.html Top Redis Use Cases By Core Data Structure Types] | |||
= Install = | |||
* '''sudo apt install'''. This will also install the '''redis-tools''' package which contains '''redis-cli''' utility. | |||
:<pre>apt-get install redis-server</pre> | |||
* build from source. [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04 How To Install and Configure Redis on Ubuntu 16.04] | |||
= Tutorial = | = Tutorial = | ||
Line 10: | Line 19: | ||
A set is similar to a list, except it does not have a specific order and each element may only appear once. | A set is similar to a list, except it does not have a specific order and each element may only appear once. | ||
= Get a help of a command = | |||
https://redis.io/topics/rediscli | |||
<pre> | |||
help XXX | |||
</pre> | |||
= Examples = | = Examples = | ||
== metacran == | == metacran == | ||
https://github.com/metacran/metacranweb | https://github.com/metacran/metacranweb | ||
= Docker = | |||
[https://markheath.net/post/exploring-redis-with-docker Exploring Redis with Docker] | |||
Start a new container running Redis | |||
<pre> | |||
docker run -d -p 6379:6379 --name redis1 redis | |||
# Run the Redis CLI in the container | |||
docker exec -it redis1 sh | |||
# redis-cli | |||
127.0.0.1:6379> set name mark | |||
OK | |||
127.0.0.1:6379> get name | |||
"mark" | |||
127.0.0.1:6379> incr counter | |||
(integer) 1 | |||
127.0.0.1:6379> incr counter | |||
(integer) 2 | |||
127.0.0.1:6379> get counter | |||
"2" | |||
127.0.0.1:6379> exit | |||
# exit | |||
</pre> | |||
Connect from another linked container | |||
<pre> | |||
docker run -it --rm --link redis1:redis --name client1 redis sh | |||
# redis-cli -h redis | |||
redis:6379> | |||
redis:6379> get name | |||
"mark" | |||
redis:6379> get counter | |||
"2" | |||
redis:6379> exit | |||
# exit | |||
</pre> | |||
Clean up | |||
<pre> | |||
docker stop redis1 | |||
docker rm redis1 | |||
</pre> | |||
= Clients in other languages = | |||
== Python == | |||
[https://realpython.com/python-redis/ How to Use Redis With Python] | |||
== R == | |||
[https://cran.r-project.org/web/packages/rredis/index.html rredis] package |
Latest revision as of 13:54, 25 October 2020
Web sites
- https://redis.io/
- https://en.wikipedia.org/wiki/Redis
- 10 Advantages of Redis. Redis has a small memory footprint and it can be installed in Raspberry Pi to enable IoT-based applications.
- Redis Advantages
- Top Redis Use Cases By Core Data Structure Types
Install
- sudo apt install. This will also install the redis-tools package which contains redis-cli utility.
apt-get install redis-server
- build from source. How To Install and Configure Redis on Ubuntu 16.04
Tutorial
set vs list
https://redis.io/topics/data-types
A set is similar to a list, except it does not have a specific order and each element may only appear once.
Get a help of a command
https://redis.io/topics/rediscli
help XXX
Examples
metacran
https://github.com/metacran/metacranweb
Docker
Start a new container running Redis
docker run -d -p 6379:6379 --name redis1 redis # Run the Redis CLI in the container docker exec -it redis1 sh # redis-cli 127.0.0.1:6379> set name mark OK 127.0.0.1:6379> get name "mark" 127.0.0.1:6379> incr counter (integer) 1 127.0.0.1:6379> incr counter (integer) 2 127.0.0.1:6379> get counter "2" 127.0.0.1:6379> exit # exit
Connect from another linked container
docker run -it --rm --link redis1:redis --name client1 redis sh # redis-cli -h redis redis:6379> redis:6379> get name "mark" redis:6379> get counter "2" redis:6379> exit # exit
Clean up
docker stop redis1 docker rm redis1
Clients in other languages
Python
R
rredis package