This is the 12th day of my participation in the August More Text Challenge. For details, see:August is more challenging
What is the redis
It can also be used as a database or a message queue. Knowing the concept, the focus of this article is on installation and usage.
The following is an official quote.
Redis is an open source (BSD licensed), in-memory data structure storage system that can be used as a database, cache, and messaging middleware. It supports many types of data structures such as strings, hashes, lists, sets, sorted sets and range queries, bitmaps, Query hyperLoglogs and geospatial index radii. Redis has built-in replication, LUA scripting, LRU Eviction, Transactions and various levels of disk persistence. High availability is provided through Redis Sentinel and automatic partitioning (Cluster).
Download and compile the installation
Download the redis file from the redis official website and decompress it
www.redis.cn/download.ht…
#LeiXueWei Demo
cd /usr/localhttp://download.redis.io/releases/redis-6.0.6.tar.gz/SRC/wget tar XZF redis - 6.0.6. Tar. GzcdRedis - 6.0.6 makeCopy the code
When running the make command, the following error occurs
C :5212:31: Error: ‘struct redisServer’ does not have a member named ‘server_cpulist’ redisSetCpuAffinity(server.server_cpulist);
This is because the underlying GCC library is so old that some functions do not exist, resulting in a compilation process in which the function/member was not found.
GCC -v # Check the GCC version
Installing and Upgrading the GCC
#LeiXueWei Demo
yum install -y centos-release-scl
yum install -y devtoolset-7-gcc*
scl enable devtoolset-7 bash
gcc -v
Copy the code
Make # recompile
Start and try out the server
Start the Redis server
Use the local CLI tool to connect to the Redis server, set the key of foo to “bar”, and verify
Changing the default port
We usually need to change the default ports when we install a server to be more secure, otherwise some port scanning tools will look at a bunch of default ports to identify breaches.
Conf and back it up. Then search for the port he 6379 keyword and change the default port
[root @ VM – 0-17 – centos redis – 6.0.6] #grep 6379 *conf
redis.conf:port 6479# Change the start port
redis.conf:pidfile /var/run/redis_6479.pid # Change the process PID name
Kill the old thread before starting. Start with the following command
Nohup. / SRC/redis server/usr/local/SRC/redis - 6.0.6 / redis. ConfCopy the code
Connect the redis server
./src/redis-cli -p 6479
Copy the code
PS: When we need to access the Redis service in the cloud host from the outside, we need to disable the bind IP line and protect mode, specifically find the protect keyword, and comment it.
Continuous learning and continuous development, I am the Lei School committee! Programming is fun, but the key is to get the technology straight. Creation is not easy, please support a lot, click like collection to support the school committee!