This post will show you how to install Redis 3.x onto Ubuntu 16.04
Redis is a server-side (Lua based) schema-free open source (in Memory) NoSQL Key/Value store database that supports replication between servers. Redis has an Eventual Consistency replication between servers (over Immediate Consistency) between servers. Eventual consistency is evil in some peoples minds, eventual consistency does require different coding considerations (to guaranteed valid data but does offer speed benefits).
Redis is the worlds 9th most popular database behind Oracle, MySQL, Microsoft SQL Server, PostgreSQL, MongoDB, DB2, Microsoft Access, Cassandra. Redis is the most popular key-value store database. View the database trend chart here.
When to use Redis over MySQL or MongoDB
Here is a great guide on when to use Redis over MongoDB. Read my previous guide on building a scalable and secure MySQL Cluster.
Redis has a place where a relational database or NoSQL document stores do not (but it is more work). Read more here.
Redis is great in situations where caching or where memory is available on the server.
Free Memory
Installing Redis on Ubuntu
Backup the conf file
Open the redis cli (and test it).
Show Redis info (from the redis-cli)
Benchmarking your Redis (quick)
Benchmarking your Redis (slow)
How to save and query a simple key/value integer
How to save and query a simple key/value string
Saving and querying multiple values
Clear all
Add to list (new items at the top)
127.0.0.1:6379> lpush testlist "a" (integer) 1 127.0.0.1:6379> lpush testlist "b" (integer) 2 127.0.0.1:6379> lpush testlist "c" (integer) 3 127.0.0.1:6379> lrange testlist 0 -1 1) "c" 2) "b" 3) "a"
Add to list (new items at the bottom)
Redis Documentation
Redis Crash Course Tutorial
More
5 uses of redis as a database.
Using Redis at scale at Twitter
Digital Ocean guide on Redis
Coming soon PHP access to Redis.
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
v1.2 Removed reference to Redis 4 in the blurb.
v1.1 Oops, this was Redis 3 and not 4 (thanks, Patrik)
v1.0 Initial version