下载redis源码包
redis官方下载地址:https://redis.io/download
[root@wyb ~]# yum -y install gcc gcc-c++ make
[root@wyb ~]# wget http://download.redis.io/releases/redis-5.0.5.tar.gz
[root@wyb ~]# tar zxvf redis-5.0.5.tar.gz
[root@wyb ~]# cd cd redis-5.0.5/
[root@wyb redis-5.0.5]# make && make install
可能出现的问题:zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录
解决办法:make MALLOC=libc (出错根据关键字百度解决)
启动前配置
- 使用软件自带脚本完成自定义配置
[root@wyb redis-5.0.5]# cd utils/
[root@wyb utils]# ./install_server.sh
Welcome to the redis service installer This script will help you easily set up a running redis server Please select the redis port for this instance: [6379] 6300
Please select the redis config file name [/etc/redis/6300.conf]
Selected default - /etc/redis/6300.conf
Please select the redis log file name [/var/log/redis_6300.log]
Selected default - /var/log/redis_6300.log
Please select the data directory for this instance [/var/lib/redis/6300]
Selected default - /var/lib/redis/6300
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6300 #端口
Config file : /etc/redis/6300.conf #配置文件目录
Log file : /var/log/redis_6300.log #日志文件目录
Data dir : /var/lib/redis/6300 #数据库目录
Executable : /usr/local/bin/redis-server #启动程序的目录
Cli Executable : /usr/local/bin/redis-cli #命令行的连接工具
Is this ok? Then press ENTER to go on or Ctrl-C to abort. #回车完成配置
Copied /tmp/6300.conf => /etc/init.d/redis_6300 #服务启动脚本
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful! #安装完成
#/etc/init.d/redis_6300 start 启动redis服务
#/etc/init.d/redis_6300 status 查看启动状态
#/etc/init.d/redis_6300 stop 停止redis服务
#/etc/init.d/redis_6300 restart 重启redis服务
##自定义配置下修改redis启动脚本