A: environmental structures
redis download http://download.redis.io/releases/redis-5.0.5.tar.gz
installation
After the download is complete, a decompression operation.
I unzipped directory / software / java / redis
cd /software/java/redis
make // (need to install GCC)
cd src
sodu make install
Configuration Hangs
redis-server is the command to start redis, but by default it is not suspended, as is similar to the tail -f
We need to set hangs in the installation directory to modify configuration files redis.conf ------ >>>> daemonize yes
Startup command is executed again, specify the configuration file
redis-server /software/java/redis/redis.conf
Two: Verify
ps verification
ps -ef | grip Redis
Command to verify
redis-cli
get set verification
Redis Common Knowledge
The default database 16, the database selected by select (0-15), but the actual process of using the database only 0
Redis common type
Common type | feature |
string | key,value |
set | Disorder does not repeat |
list | Ordered be repeated |
hash | string,(key,value) |
token | Ordered not to repeat |
Redis commonly used commands
keys key (inquiry All key)
exists key (key exists: 1 is present, absent 0)
type key (key type)
del key (删除 key)
expire key (set the expiration time for the key)
ttl key (see key)
dbsize(查询库里面key数量)
flushdb(清空当前数据库)
flushall(清空所有数据库)