In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "detailed steps of Redis installation and configuration". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the detailed steps of Redis installation and configuration.
Installation
Download, extract, compile:
$wget http://download.redis.io/releases/redis-4.0.10.tar.gz
$tar xzf redis-4.0.10.tar.gz
$mv redis-4.0.10 / usr/local/redis
$cd / usr/local/redis
$make
The binaries are compiled in the src directory
$ll-a src | grep redis
-rw-rw-r-- 1 root root 2.4K Jun 13 19:02 redisassert.h
-rwxr-xr-x 1 root root 2.6m Sep 14 12:05 redis-benchmark
-rw-rw-r-- 1 root root 29K Jun 13 19:02 redis-benchmark.c
-rw-r--r-- 1 root root 129K Sep 14 12:05 redis-benchmark.o
-rwxr-xr-x 1 root root 6.0m Sep 14 12:05 redis-check-aof
-rw-rw-r-- 1 root root 7.0K Jun 13 19:02 redis-check-aof.c
-rw-r--r-- 1 root root 38K Sep 14 12:05 redis-check-aof.o
-rwxr-xr-x 1 root root 6.0m Sep 14 12:05 redis-check-rdb
-rw-rw-r-- 1 root root 14K Jun 13 19:02 redis-check-rdb.c
-rw-r--r-- 1 root root 68K Sep 14 12:04 redis-check-rdb.o
-rwxr-xr-x 1 root root 2.8m Sep 14 12:05 redis-cli
-rw-rw-r-- 1 root root 99K Jun 13 19:02 redis-cli.c
-rw-r--r-- 1 root root 450K Sep 14 12:05 redis-cli.o
-rw-rw-r-- 1 root root 22K Jun 13 19:02 redismodule.h
-rwxr-xr-x 1 root root 6.0m Sep 14 12:05 redis-sentinel
-rwxr-xr-x 1 root root 6.0m Sep 14 12:05 redis-server
-rwxrwxr-x 1 root root 65K Jun 13 19:02 redis-trib
Redis-server is the server program and redis-cli is the client program.
Create a service
After the binary file is compiled, in the src directory, start the Redis service with the following command:
$ln-s / usr/local/redis/src/redis-cli / usr/bin/redis
$ln-s / usr/local/redis/src/redis-server / usr/bin/redisd
Output version
$redis-version
Redis-cli 4.0.10
$redisd-version
Redis server vault 4.0.10 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=e53a76b77e60d5b0
At this point, your redis has been installed.
Configuration
Why should the configuration list a separate title?
This is because Redis does not maximize the optimization of security aspects, but tries to optimize high performance and ease of use as much as possible.
Redis opens port 6379 by default, which can cause any user to perform unauthorized access operations if authentication is not enabled.
So we need to do some security configuration here.
New users
Never start Redis with a user with higher privileges. If your Reidis is not secure, then your highly privileged users will become a breakthrough, causing your server to be attacked.
So we need to create a redis account, start the redis service through this account, and configure the account to disable login.
$adduser redis
$vim / etc/passwd
Redis:x:1001:1001:,:/home/redis:/usr/sbin/nologin
$chown-R redis:redis / usr/local/redis
Modify the configuration file
You are required to have a basic operation on vim.
$vim redis.conf
# modify the port around line 92
Port 7379
# Log files around line 171
Logfile / var/log/redis/redis.log
# set the snapshot file directory around line 263, and do not set it to a directory where the redis user does not have permission
Dir / usr/local/redis/
# set a password around line 500
Requirepass YOUR_PASSWORD
$mkdir / var/log/redis
$chown-R redis:redis / var/log/redis/
Configure a launcher
Redis-server is not started by the daemon by default, so we need to configure a launcher for it
.
$vim / usr/bin/goredisd
Nohup / usr/bin/redisd / usr/local/redis/redis.conf > > / var/log/redis/goredisd.log 2 > & 1 &
$goredisd
$ps-axu | grep redis
Redis 19498 0.0 0.1 145304 2580 pts/0 Sl 10:49 0:09 / usr/bin/redisd *: 7379
Thank you for your reading, the above is the content of "detailed steps of Redis installation and configuration". After the study of this article, I believe you have a deeper understanding of the detailed steps of Redis installation and configuration, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.