In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In about 2010, I once chatted with a colleague. At that time, I knew about Redis. So far, I haven't downloaded a Redis version to play with the technology.
With only more than 10,000 lines of code, it is famous for its amazing performance. Yang Weihua, architect of Sina Weibo (I flipped through Wechat, turned out to be Tim Yang) once said: "it is estimated that the sub-products of the top 10 websites in China can meet the needs of storage and Cache with one Redis."
Since March 15, 2010, the development of Redis has been presided over by VMware. Since May 2013, the development of Redis has been sponsored by Pivotal. Wherever the father of Redis goes, there is a new label.
Here is the Italian programmer Salvatore Sanfilippo, the father of Redis
My DBAplus community has also planned the periodic technological development newsletter, in which I am responsible for collecting some information. I have also had simple communication with all the big names in the industry, and I can also get first-hand information on Redis.
The official Redis is https://redis.io/, and there are also Redis user groups and related Chinese sites in China. I would also like to thank some of these people who have contributed silently to the community. With this circle, technical personnel will not be more lonely.
The latest version of Reids is 4.0.1. After I downloaded it from the government, I found that the zip package is only 1.6m, and after decompression, it is about 8.4m, which is the size of many relational database patches. So it aroused my interest. Not to mention in-depth, our bureau starts from downloading, installation and deployment.
As you can see from the README documentation, the official provides the following useful links.
Introduction to Redis data types:
Http://redis.io/topics/data-types-intro
Redis command line:
Http://redis.io/commands
Redis official documentation:
Http://redis.io/documentation
# rpm-qa | grep gcc
Libgcc-4.4.7-4.el6.x86_64
Gcc-4.4.7-4.el6.x86_64
Installation and deployment is very simple, is a make command, of course, if you want enterprise customization, there are still some parameters to pay attention to.
The compiled Redis directory is about 73m.
[root@oel1 redis-4.0.1] # du-sh.
73M
There is a very important file in this directory, and that is the configuration file redis.conf of redis
When starting, if you don't declare it, the default redis.conf file is used under this path by default.
Start Redis
. / redis-server &
The default port is 6379
Close Redis
#. / src/redis-cli shutdown
Enter command line mode:
[root@oel1 src] #. / redis-cli
127.0.0.1 purl 6379 > help
Redis-cli 4.0.1
...
Because Reids stores key values, let's test it briefly. To my surprise, there is a command prompt function that automatically prompts you for commands.
127.0.0.1 purl 6379 > set name jeanron
OK
Get the newly initialized name
127.0.0.1 purl 6379 > get name
"jeanron"
Redis supports a variety of data types: string (string), hash (hash), list (list), set (set) and zset (sorted set: ordered set), HyperLogLogs (a probability-based data structure for counting the number of different elements in a set)
For example, List uses rpush,rrange,lrange,lpush to operate.
You can push elements individually.
127.0.0.1 purl 6379 > rpush mylist a
(integer) 1
127.0.0.1 purl 6379 > rpush mylist b
(integer) 2
List the elements in the list
127.0.0.1 lrange mylist 6379 > 0-1
1) "a"
2) "b"
Add some elements to list
127.0.0.1 6379 > rpush mylist 12 3
(integer) 5
127.0.0.1 lrange mylist 6379 > 0-1
1) "a"
2) "b"
3) "1"
4) "2"
5) "3"
You can also have pop operations on queue data structures, such as elements at the end of pop
127.0.0.1 purl 6379 > rpop mylist
"3"
127.0.0.1 lrange mylist 6379 > 0-1
1) "a"
2) "b"
3) "1"
4) "2"
Check the length of the list.
127.0.0.1 purl 6379 > llen mylist
(integer) 4
If it corresponds to some basic data types, there are some additional operations available, such as self-increment like a sequence.
127.0.0.1 set counter 6379 >
OK
127.0.0.1 purl 6379 > incr counter
(integer) 101
127.0.0.1 purl 6379 > incr counter
(integer) 102
127.0.0.1 incrby counter 6379 >
(integer) 202
We can also manage these key-value pairs, such as determining whether they exist and, if so, leaving and deleting them.
127.0.0.1 purl 6379 > exists counter
(integer) 1
127.0.0.1 purl 6379 > del counter
(integer) 1
127.0.0.1 purl 6379 > exists counter
(integer) 0
If you want to see the status information of the entire Redis, you can use the command info, and the output is divided into several dimensions to display this information.
127.0.0.1 purl 6379 > info
# Server
Redis_version:4.0.1
Redis_git_sha1:00000000
Redis_git_dirty:0
Redis_build_id:f9229e185138419b
Redis_mode:standalone
Os:Linux 3.8.13-16.2.1.el6uek.x86_64 x861464
Of course, the above operation is only a small fraction of the operation in Redis, or a lot of content to study in detail.
Finally, it should be noted that today is the Victory Day of the War of Resistance against Japan, paying tribute to the martyrs and heroes.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.