This is the seventh day of my participation in the August More text Challenge. For details, see:August is more challenging”
Introduction to Redis
Remote Dictionary Server is a high-performance NoSQL database written in C, open source, running in memory and supporting persistence. It is also one of the most popular NoSQL databases.
Second, the characteristics of Redis
1. Support data persistence
Redis supports data persistence, which keeps data in memory on disk and can be reloaded and used upon restart.
2. Support for multiple data structures
Redis supports not only simple key-value data, but also lists, sets, zsets, hash and other data structures.
3. Support data backup
Redis supports data backup in master-slave mode.
Install Redis on Linux
Step 1: Download Redis
redis.io/
Step 2: Use the Xftp tool to upload redis-5.0.2.tar.gz to Linux.
Step 3: Decompress redis-5.0.2.tar.gz to the /opt directory
Step 4: Compile redis, go to the decompressed directory, and run the make command:
Error: GCC command not found
Step 5: Install GCC.
1) What is GCC?
GCC is short for GNU Compiler Collection, which is the next set of compilers for Linux (equivalent to JavAC) and is an editor for C or C ++ programs.
2) How to install GCC?
Method 1: Use yum to install the server on the Internet. Run the yum -y install GCC command.
Method two: in the case of no external network, from the DISC installation.
1、从终端进入目录:/run/media/root/CentOS 7 x86_64/Packages
2. Run the following commands one by one:
RPM -ivh libmc-1.0.1-3.el7.x86_64. RPM Press Enter
RPM -ivh cpp-4.8.5-11.el7.x86_64. RPM Press Enter
RPM -ivh kernel-headers-3.10.0-514.el7.x86_64. RPM Press Enter
RPM -ivh glibc-headers-2.17-157.el7.x86_64. RPM Press Enter
RPM -ivh glibc-development-2.17-157.el7.x86_64. RPM Press Enter
RPM -ivh libgomp-4.8.5-11.el7.x86_64. RPM Press Enter
RPM -ivh gcc-4.8.5-11.el7.x86_64. RPM Press Enter
3. Run the GCC -v command to view the Linux kernel version
Step 6: Go back to the redis decompression directory and run the make command to compile
Step 7: Clean up
Step 8: Run the make command again to compile:
Step 9: Run make install to install redis:
Note: Make install is executed after make, which copies many of the executable files from SRC to /usr/local/bin. By doing so, you can run redis software commands (such as start, stop, client connect server, etc.) in any directory. Make install can not be executed, depending on personal habits. To view the results of the make compilation, go to the CD SRC directory
Step 10: Start Redis
Boot mode:
① Start the Redis-server on the front desk
② Start redis-server & in the background
③ Start the configuration file according to the configuration file
Note: If you modify the redis configuration file redis.conf, you must specify the configuration file at startup, otherwise the change will not take effect!
Step 11: Disable the Redis service
Closing mode:
① Use the Redis client to shut down and issue a shut down command to the server
Run the redis-cli shutdown command in any directory
This method is recommended. Redis completes the data operation first and then closes.
Such as:
② Kill PID or kill -9 PID
In this case, the application is shut down regardless of whether the current application has data performing operations.
First to use ps – ef | grep redis, find out process in the use of the kill pid
\