- Preface
The author of Redis is Salvatore Sanfilippo (antirez) from Italy, and antirez is his stage name. Now he has been recruited by VMWare to do redis at ease. I don't know if he likes the Italian singer Alessia Merz or hates it. Anyway, he set the default port of redis to 6379, which is the number corresponding to MERZ on the phone button. Setting the port number to the name of a beautiful woman is full of sexual intentions and also reflects the emptiness and loneliness of the programmer group.
Pictured is Alessia Merz
The author of Redis published a blog on Friday, March 6, 2009, in which he mentioned his redis. At this time, redis is not even the 0.1 version, but a beta 4 version.
We will start with the bottom version.
This version of the redis logo is really not good-looking.
"I think this is the first time I have talked about redis on this blog, but I hope it's not the last time.
Redis will be my main goal for hacking sessions next year, I hope this can be achieved.
What exactly does Redis do? It is a key-value database. But it is different from memcachedb (a persistent version of memcached) and other similar databases. For example, many key-value databases can be operated like this:
SET mykey foobar
GET mykey
DEL mykey
This makes it easier for calculations that do not require locking, such as set-if-not-exists operations and so on. The feature of Redis is that it can not only have string type data, but also store data structures such as List Set.
LPUSH user_100_messages "Indeed, you are right!"
LPUSH user_100_messages " .... "
LRANGE user_100_messages 0 10
The first two operations are to put elements in the linked list, and the last operation is to display the first 10 elements in the linked list. You can also perform similar addition, deletion, modification, and check operations on Sets, and the union of several sets. "
This is an excerpt and translation from the author's blog. It can be clearly seen that the goal of redis is to become a data structure server, to provide programmers with the greatest convenience and to make up for the shortcomings of relational databases, and the source code of such databases is available to both novice programmers and many years of veteran sailors Where to learn.
The biggest advantage for beginner programmers is how to turn the data structure learned on campus into an excellent wheel, and put their theoretical knowledge into practice almost seamlessly. However, nothing can be learned by looking at the perfect source code directly. Only after experiencing a pit in the wheel creation process can you learn to code well.
So I thought of updating redis 1.0 to redis 3.0, which I thought was a bit of reference, and amending the bug fixes to record.
The author first mentioned his redis redis google code on his blog
- Chapter 1: Test the first beta version of redis author
Because the redis version can only run on linux, it needs a linux environment. If it is a Mac or linux system, you can skip the content below, if it is windows, you can refer to it.
First we need to obtain a virtual machine. The author uses VMware workstation 12player, which is a free version of VMware's desktop, which is simple and easy to use.
After the download is complete,
you need to download linux. I chose the latest version of ubuntu, Ubuntu 14.04.1 LTS.
ubuntu download address
Choose this version for developers.
Install vmware first, and open the following figure after installation.
Then create a virtual machine and choose to store the virtual machine as a single file, because it's just an experiment and it's personal preference.
I want to run ubuntu14 smoothly and give more memory.
Install ubuntu, open the terminal, use wget command to download the source file of redis beta1, this link needs to be over the wall.
http://redis.googlecode.com/files/redis-beta-1.tar.gz
The old version of redis is on google code
http://code.google.com/p/redis/
use
tar -xvf redis-beta-1.tar.gz
To decompress.
Then enter the make command to compile, and then you have redis. It's that simple.
enter
./redis-server
Can run
Then open a terminal window. Then go to the directory where redis was compiled just now
make test
There is an error in the result. This bug will be explained in the next process and then corrected.
Of course, this is an automated test script, which calls the tcl script test-redis.tcl.
We can also use telnet to connect to redis
telnet locahost 6379
Then type
lrange mylist 0 10
Will get the value in the linked list just inserted by make test.
To be continued, I will write some basic usage of redis and detailed explanation of redis architecture.