Redis download
Official website address:redis.io/Download address:Download. Redis. IO/releases/re…
The installation of redis
The redis installation environment will be installed on the Linux system. Step 1: Install VMware, and install centos in VMware. Step 2: upload the redis compressed package to the Linux system Step 3: Decompress the redis compressed package after the file is written in C language source file
/ root @ localhost ~ # tar - ZXF redis - 3.0.0. Tar. GzCopy the code
Step 4: Install the C language environment (after installing centos, the C language environment comes with it)
[root@localhost ~]# yum install gcc-c++
Copy the code
Step 5: Compile the redis source code
[root@localhost ~]# cd redis-3.0.0
[root@localhost redis-3.0.0]# make
Copy the code
Step 6: Install Redis
[root@localhost redis-3.0.0]# make install PREFIX=/usr/local/redis
Copy the code
Step 7: Check whether the installation is successful
[root@localhost redis-3.0.0]# cd /usr/local/redis
[root@localhost redis-3.0.0]# ll
Copy the code
Redis start
1. Start the front end
Front-end startup commands:
[root@localhost bin]# ./redis-server
Copy the code
Front-end startup shutdown:
Forcible shutdown: Ctrl+ C Normal shutdown: [root@localhost bin]#./redis-cli shutdownCopy the code
Startup interface:Front-end startup issues: Once the client is shut down, the Redis service is shut down.
2. Start the backend
Step 1: Copy the redis. Conf file in the decompressed redis source package to the bin directory
[root@localhost bin]# cp /root/redis-3.0.0/redis.conf./Copy the code
Conf file and change daemonize to yes using vim redis.confStep 3: Start Redis using the command back end
[root@localhost bin]# ./redis-server redis.conf
Copy the code
Step 4: Check whether the startup is successful
[root@localhost bin]# ps -aux | grep redis
Copy the code
To turn off the backend boot mode:
Forcibly shutdown: [root@localhost bin]# kill -9 5071 normal shutdown: [root@localhost bin]#./redis-cli shutdownCopy the code
In projects, it is recommended to use normal shutdown. If redis is used as a cache, the data is stored in memory. If redis is turned off normally, the memory data will be persisted locally and then closed. If the shutdown is forced, persistent operations are not performed, and some data may be lost.