当前位置:网站首页>Redis installation on centos7
Redis installation on centos7
2022-07-06 17:17:00 【Xiaobai said (๑• ๑)】
List of articles
CentOS7 On Redis install
1、redis Upload + compile + install
Download ahead of time redis-xxx.tar.gz The compressed file of , Then upload it locally redis Compress the file to the server . Drag and drop ( I'm using Xhell, Pay attention to the dragged directory , Upload to the directory where you drag it ) If appear :
-bash: rz: Command not found , perform :
yum -y install lrzsz
After uploading , Unzip the uploaded file
tar xzf redis-3.2.8.tar.gz # -zxvf
Decompression is obtained. redis-3.2.8 Folder , Get into redis-3.2.8 Folder , First, execute gcc -v, Check to see if there is gcc compiler , If you don't have to perform this step , Otherwise, skip :
yum -y install gcc automake autoconf libtool make # install gcc compiler
compile redis The source file , Generate executable files :
make MALLOC=libc # Compile directly in the current directory , And generate the executable file to src Under the directory .
If you want to generate executable files into a pure directory , It can be executed :
make install PREFIX=/usr/local/redis/redis # Will be in redis The directory always generates one bin Folder , There are executable files
Choose one of the two compilation methods .
So far, the compilation and installation are all completed , Has been able to put redis It's working . At this time, the default configuration file is used for startup .
notes ! Can be in /usr/local/redis/redis Create three folders under the directory :
mkdir data # discharge redis Cached data
mkdir conf # discharge redis Configuration file for
mkdir logs # discharge redis Log file of execution
2、systemctl start-up redis+ Boot up redis
The installation is completed by decompressing redis after , If you want to Use systemctl start-up You need to write a script file to complete the startup process ( Automatic installation may not have this trouble !).
Use service To manage services , Need to be in /etc/init.d/ Create a script file in the directory .
Use systemctl similar :
- Get into
/lib/systemd/systemDirectory scripting file rediss.service
cd /lib/systemd/system # Enter the directory
vi redis.service # Create and edit
redis.service The contents of the document are as follows :
[Unit] #[Unit]: It means that this is the basic West Sydney
Description=Redis #Description: describe
After=network.target #After: Indicates which application is launched after , Generally, it starts after the network service
[Service] #[Service]: Here is the service information
ExecStart=/usr/local/redis/redis/bin/redis-server /usr/local/redis/redis/conf/redis.conf --daemonize no #ExecStart: The command to start the service ( Path configure your actual installation path )
# If you need a password to connect to the client, configure :
# ExecStop=/usr/local/redis/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a password shutdown
ExecStop=/usr/local/redis/redis/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown #ExecStop: Order to stop service
[Install] #[Install]: Indicates the relevant Western Sydney installed
WantedBy=multi-user.target #WantedBy: How to start :multi-user.target It shows that when the system is in multi-user mode ( Default run level ) Startup time , This service needs to be run automatically
- Create a soft connection
The purpose of creating a soft connection is , Automatically start the service preparation when the system is initialized .
Create a soft connection for the script file just created ( Be similar to windows Desktop shortcuts in the system ).
#ls -s Establish a soft connection
#ls -s source address Destination address
ls -s /lib/systemd/system/redis.service /etc/systemd/system/multi-user.target.wants/redis.service
- Refresh configuration + start-up + stop it + restart
Just finished configuring systemctl After that, you need to refresh the configuration to take effect .
systemctl daemon-reload # Refresh configuration
systemctl start redis # perhaps systemctl start redis.service--> Turn on redis
ps -ef|grep redis # After starting, you can check whether it has redis The process of
systemctl stop redis # perhaps systemctl stop redis.service--> stop it redis
systemctl restart redis # perhaps systemctl restart redis.service--> restart redis
- redis Power on self start and disable
systemctl enable redis # Boot from boot
systemctl disable redis # Disable power on auto start
systemctl status redis # View the current redis Start state of
Reference link
https://blog.csdn.net/penyoudi1/article/details/53692218
https://www.cnblogs.com/mr-wuxiansheng/p/12494124.html
边栏推荐
- Akamai 反混淆篇
- 【MMdetection】一文解决安装问题
- Ce n'est qu'en apprenant que c est à la hauteur des attentes Top5 s1e8 | s1e9: caractères et chaînes & opérateurs arithmétiques
- The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
- 字节跳动海外技术团队再夺冠:高清视频编码已获17项第一
- Go language uses the thrift protocol to realize the client and service end reports not enough arguments in call to oprot Writemessagebegin error resolution
- Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
- Only learning C can live up to expectations top2 P1 variable
- "One year after graduation, I won ACL best paper"
- Activit零零碎碎要人命的坑
猜你喜欢

吴军三部曲见识(四) 大家智慧

Akamai 反混淆篇

Log4j2 major vulnerabilities and Solutions

Flink 解析(四):恢复机制

Garbage first of JVM garbage collector

February database ranking: how long can Oracle remain the first?

Serial serialold parnew of JVM garbage collector

JVM运行时数据区之程序计数器

Activiti directory (IV) inquiry agency / done, approved

Mongodb learning notes
随机推荐
Log4j2 major vulnerabilities and Solutions
8086 memory
ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items
JVM class loading subsystem
面试集锦库
汇编语言寻址方式
Interpretation of Flink source code (III): Interpretation of executiongraph source code
Basic knowledge of assembly language
Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
Set up the flutter environment pit collection
Activiti directory (IV) inquiry agency / done, approved
On the clever use of stream and map
Compile homework after class
Flink源码解读(一):StreamGraph源码解读
Activiti目录(一)重点介绍
CentOS7上Redis安装
yum install xxx报错
关于Stream和Map的巧用
Flink 解析(四):恢复机制
Activit零零碎碎要人命的坑