Step One: Download the installation package
1, may be used in the linux wget download terminal:
wget http://download.redis.io/releases/redis-5.0.7.tar.gz
2, can also be downloaded in the window of a good package and then copy to install linux in / usr / local by remote file management tool / directory
Https://redis.io/download access to our website for download. Here to install the 5.0.7 version, for example (note here that I have installed, so there will be redis-5.0.7 directory; only here to download screenshots tell the location where the installation package)
Step Two: unzip and install
1, extract the installation package
takes -xzvf redis- 5.0 . 7 . takes .gz
2, after the files are decompressed directory
cd redis- 5.0 . 7 /
Execution cat Makefile Makefile to view the content
Meaning that, when installed by default is to enter into the src directory redis in the installation (of course, you can enter the src directory redis installed, simply stated here it can be executed directly make install to install)
3, be mounted directly execute make install
make install
Because it is first compiled to install, the installation takes a few minutes of time, be patient
4. After installing the src directory will be more about executable file, which we try to open redis redis server and client testing
First enter the src directory
[root@centosLYH redis-5.0.7]# cd src/ [root@centosLYH src]# pwd /usr/local/redis-5.0.7/src
Start redis server
redis-server
Implementation of the results
To not close the terminal, and then open a terminal at this time we will also be the start of src directory redis redis client
redis-cli
After we open the client simple test
The test is successful; the installation is successful
You can specify a port open to the specified service port connection service (default port 6379)
1, specify the server port number to open
redis-server --port 6380
At this open port 6380 was used
2, the port number specified client connections
redis-cli -p 6380
Specify the configuration file to start the service redis
Then turn redis services we will be prompted to
He said we did not specify the configuration file, using the default configuration;
Our profile is the installation directory in redis
In order to facilitate future management of multiple profiles redis
We create a conf directory in the installation folder redis
mkdir conf
The redis.config move files to create the conf folder
mv redis.conf conf /
We then redis in the installation directory to create a data directory to store log information services redis
mkdir data
Then we go back to the conf directory under the directory redis create a new profile
I came redis6380.conf
Write the following and then save
port 6380 daemonize yes logfile "6380.log" dir /usr/local/redis-5.0.7/data
port: Specifies the service port open
daemonize: yes when service is turned on when opened as a daemon in the background
logfile: specify the file to which the log output
dir: "DETAILED Specifies the path to the log file output"
Start the service at this time we returned to redis installation directory and then specify the configuration file form
redis-server ./conf/redis6380.conf
Daemonize we can see that because of the configuration in the configuration file to yes, so the service is no longer open redis output a lot of log information; as a daemon running in the background
And through client connections, because we specified in the configuration file for the 6380 service port, you need to specify the connection port for the 6380
redis-cli -p 6380
Then exit back to redis we create the data directory can see the specified log file has been entered log
cat data/6380.log
Some operations redis process
Detect whether there is a background process
ps -ef | grip Redis
6379 detects whether the port is listening
netstat -lntp | grep 6379
Stop redis:
1, using the client
redis-cli shutdown
2, since Redis can properly handle the SIGTERM signal, it is also possible to directly kill -9 (via ps -ef | grep redis- process first redis service ID to check out)
the kill - 9 process ID
Description redis profile: ps
redis.conf configuration parsing (red basic settings you can own use, bind configuration 0.5 0.0 After 0.01 to the / etc / sysconfig / configure the port iptables): daemonize: If you need to run in the background, put the item value to Yes pdifile: pid files in the / var / RUN / redis.pid, other addresses can be configured to bind: Specifies redis only receive requests from the IP, if not set, then process all requests in the production processes the best setting (set to 0. 0.0 . 0 will be replaced by iptables to control access) port: listening port, default 6379 timeout: set the timeout when the client connections, in seconds loglevel: level is divided into grade 4, debug, revbose, notice and warning. Usually production environment Open Notice logfile: configuration log file address, the standard default output, i.e., printing on the command line port terminal database: setting the number of database, the database is used by default 0 Save: redis provided for database mirroring frequency rdbcompression: when the image backup is performed, whether compressed dbfilename: file name of the image backup file dir path of the file database mirroring placement: slaveof: Set the database from the database to other databases masterauth: when the primary database connections that require password authentication, set here requirepass: setting any password before other specified required after the connection client maxclients: limit the number of simultaneous client connections maxmemory: redis set the maximum memory that can be used appendonly: after opening appendonly mode, redis will each received a write operation are appended to the file appendonly.aof, when redis restarted, will resume from the previous document state appendfsync: set appendonly.aof file synchronization frequency vm_enabled: whether to open the virtual memory support vm_swap_file: path set the virtual memory swap file size maximum physical memory, virtual memory settings after opening, redis to be used, the default is 0: vm_max_momery vm_page_size: set the virtual memory page size vm_pages: set the swap file total page number vm_max_thrrads: set the number of threads used simultaneously vm IO