
linux下centos7.2下安装redis 4.0.6
Create a Redis directory in
发布日期:2021-05-13 19:18:24
浏览次数:17
分类:精选文章
本文共 2137 字,大约阅读时间需要 7 分钟。
installation and startup of Redis
Installation of Redis
Step 1: Download Redis Installation Package
Use wget to download the latest Redis installation package:
wget http://download.redis.io/releases/redis-4.0.6.tar.gz
Step 2: Unzip the Compressed Package
Unzip the downloaded file using tar:
tar -zxvf redis-4.0.6.tar.gz
Step 3: Install GCC Dependencies
Install GCC using yum:
yum install gcc
Step 4: Enter the Redis Installation Directory
Move to the directory where Redis was unzipped:
cd redis-4.0.6
Step 5: Compile and Install Redis
Compile Redis with specific MALLOC library support and install:
make MALLOC=libccd src && make install
Redis Startup Methods
Method 1: Direct Startup
Run Redis in interactive mode:
./redis-server
This method requires constant screen attention.
Method 2: Running as a Daemon
Modify the Redis configuration (redis.conf
) to enable daemon mode:
echo 'daemonize yes' >> redis.conf
Start Redis in daemon mode:
./redis-server /etc/redis/redis.conf
Method 3: Setting Redis to Start Automatically
/etc/
:mkdir /etc/redis
- Create a configuration file in
/etc/redis/6379.conf
: - Create a startup script in
/etc/init.d/redisd
: - Enable Redis to start automatically:
- Modify the Redis configuration to remove binding restrictions:
- Start Redis and ensure the port is accessible. If needed, adjust firewall rules:
cp /usr/local/redis-4.0.6/redis.conf /etc/redis/6379.conf
cp /usr/local/redis-4.0.6/utils/redisd /etc/init.d/redisd
# Modify the first line of /etc/init.d/redisdecho '# chkconfig:2345 90 10' > /etc/init.d/redisdecho '# description: Redis is a persistent key-value database' >> /etc/init.d/redisd# Enable servicechkconfig redisd on
Now Redis can be started and stopped using:
service redisd start651service redisd stop
Common Issues
###Port Access Issues
# Remove or comment out bind 127.0.0.1# in /usr/local/redis-4.0.6/redis.conf
systemctl stop firewalld.servicesystemctl disable firewalld.service
Service Management
If the service fails to start due to PID file issues:
rm /var/run/redis_6379.pid
Note
Refer to official Redis documentation for more details: Redis Documentation
发表评论
最新留言
留言是一种美德,欢迎回访!
[***.207.175.100]2025年04月15日 17时29分20秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
两正态总体参数的检验
2021-05-12
C# WinForm程序退出的方法
2021-05-12
ubuntu安装gem和fastlane
2021-05-12
onFailure unexpected end of stream
2021-05-12
android 集成weex
2021-05-12
【echarts】中国地图china.js 在线引用地址
2021-05-12
Flex 布局的自适应子项内容过长导致其被撑大问题
2021-05-12
PL/SQL 动态Sql拼接where条件
2021-05-12
Lua-table 一种更少访问的安全取值方式
2021-05-12
虚函数
2021-05-12
菱形继承
2021-05-12
RTL设计- 多时钟域按顺序复位释放
2021-05-12
斐波那契数列两种算法的时间复杂度
2021-05-12
int main(int argc,char* argv[])详解
2021-05-12
【Android踩过的坑】7.Android Studio 点击启动项目时进入调试模式
2021-05-12
【Android小技巧】1.快速查看SDK对应的API Level
2021-05-12
【自学Flutter】4.1 Material Design字体图标的使用(icon)
2021-05-12