redisOfficial address: http://www.redis.cn/download.html
RedisIt is an advanced key-value database. It’s similar to memcached, but data can be persisted, and it supports a wide range of data types. There are strings, linked lists, sets and ordered sets. Support for computing union, intersection and complement sets on the server sideE) and so on. It also supports a variety of sorting functions. So Redis can also be seen as a data structure server.
RedisAll data is stored in memory and then periodically asynchronously saved to disk (this is called “semi-persistent mode”); each data change can also be written into an append only file (aof) (this is called “full persistent mode”).
Start installation below:
1.Download the redis installation package
# wget http://download.redis.io/releases/redis-2.8.3.tar.gz
2.Unzip installation package
# tar -zxvf redis-2.8.3.tar.gz
# make install
# cp redis.conf /etc/
Introduction of parameters:
make installWhen the command is executed, this executable file will be generated in the / usr / local / bin directory, namely redis-server, redis-cli, redis-benchmark, redis-check-aof, redi.S-check-dump, their functions are as follows:
redis-server：RedisServer daemon startup program
redis-cli：RedisCommand Line Operating Tools. You can also use telnet to operate according to its plain text protocol
redis-benchmark：RedisPerformance Testing Tool to Test Redis’s Read-Write Performance under Current System
redis-check-dump：Check export tools
4． Modify the system configuration file to execute commands
a) echo vm.overcommit_memory=1 >> /etc/sysctl.conf
b) sysctl vm.overcommit_memory=1 Or echo vm. overcommit_memory = 1 & gt; & gt; / proc / sys / VM / overcommit_memory
Use numerical meanings:
0，Represents that the kernel will check whether there is enough available memory for the process to use; if there is enough available memory, the memory application is allowed; otherwise, the memory application fails and the error is returned to the application process.
1，Represents that the kernel allows all physical memory to be allocated regardless of the current memory state.
2，Represents that the kernel allows allocation of memory beyond the sum of all physical memory and swap space
5． Modify redis configuration file
a) $ cd /etc
b) vi redis.conf
c) Modify daemonize yes — to make the process run in the background
Introduction of parameters:
daemonize：Is it running in daemon mode
port：Port number to listen on
databases：Number of open databases
save * *：The frequency at which snapshots are saved, the first * indicates how long it takes, and the second * indicates how many write operations are performed. When a certain number of write operations are executed within a certain period of time, snapshots are automatically saved. Multiple conditions can be set.
rdbcompression：Whether to use compression or not
dbfilename：Data snapshot file name (file name only, not directory)
dir：Storage directory for data snapshots (this is the directory)
appendonly：Whether to open appendonlylog or not, each write operation will record a log, which will improve data anti-risk ability, but affect efficiency.
appendfsync：appendonlylogHow to synchronize to disk (three options: forcing fsync to be called every write, enabling fsync once a second, and not calling fsync to wait for the system to synchronize itself)
6． Start redis
a) $ cd /usr/local/bin
b) ./redis-server /etc/redis.conf
7． Check if the startup is successful
a) $ ps -ef | grep redis
Enter redis command:. / redis-cli-h 127.0.0.7-p 6379
Simple string operation:
set name str
The above is a personal installation process for reference only.