What's Redis?
REmote DIctionary Server (Redis) is a Key-value storage system written by Salvatore Sanfilippo. Redis provides a wealth of data structures, including lists, sets, ordered sets, and hashes, and of course memcached. Redis Of course also includes a wealth of operations on these data structures.
Advantages of Redis
Extremely high performance –redis can support more than 100k+ per second read and write frequency.
Rich data types –redis supports Strings, Lists, hashes, Sets, and Ordered Sets data type operations for binary cases.
All operations of atomic –redis are atomic, while Redis also supports the atomic execution of several operations.
Rich features –redis also supports PUBLISH/SUBSCRIBE, notification, key expiration, and so on.
Installation of Redis
Redis Official website: http://www.redis.io/
The following is the current version of the 2.6.16 installation, the specific version may be different
Cd/usr/local/src
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
TAR-ZXVF redis-2.6.16.tar.gz
CD redis-2.6.16
Make
So simple, the Redis is complete.
Of course, in order to more convenient management Redis, I did the following operations
#redis配置目录
Mkdir-p/usr/local/redis/etc
#redis命令目录
Mkdir-p/usr/local/redis/bin
#移动配置文件到配置目录
MV redis.conf/usr/local/redis/etc/
CD src
#移动所有redis命令到命令目录
MV mkreleasehdr.sh Redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server/usr/local/redis/bin
Start Redis
Vim/usr/local/redis/etc/redis.conf
#将daemonize No to daemonize Yes, mainly for background startup
#配置文件内容不算太多以后做个详解
Daemonize Yes
#启动redis, to specify the configuration file directory when starting Redis
Cd/usr/local/redis/bin
./redis-server. /etc/redis.conf
Netstat-tnl
#可以看到6379这个端口, this is the Redis default port
Since the Redis has been started, then we use the Redis client to see Redis
./redis-cli
The Redis client has been entered at this time for a simple test
#目录不用具体了解他们什么意思
#先玩一下, will be introduced in detail later
Set name ' TestName '
Get Name
Exit Client
Exit
Set Redis to boot
Vim/etc/rc.local
#在最下面一行添加
/usr/local/redis/bin/redis-server/usr/local/redis/etc/redis.conf
To add a redis command to an environment variable
Vim ~/.bash_profile
#PATH这个变量最后面加上:/usr/local/redis/bin
#我个人的PATH路径如下 [When you modify, just add:/usr/local/redis/bin to your Path]
#不用和我的完全一样
Path= $PATH: $HOME/bin:/data/python/code:/usr/local/nginx/sbin:/usr/local/redis/bin
Let environment variables take effect immediately
SOURCE ~/.bash_profile
Three ways to turn off Redis
Pkill redis-server[If close recommend this article]
ID number of Kill-s 9 Redis
/USR/LOCAL/REDIS/BIN/REDIS-CLI shutdown