美文网首页
redis3.0.4编译安装

redis3.0.4编译安装

作者: 冰岛星 | 来源:发表于2020-05-28 15:51 被阅读0次

Redis的应用场景:
缓存系统、计数器、排行榜、消息队列、实时系统,基本上社交媒体的功能都可以通过Redis实现。
redis各版本下载地址:http://download.redis.io/releases/

一、安装redis:
[root@localhost ~]# tar -xf redis-3.0.4.tar.gz -C /usr/local/redis
[root@localhost ~]# cd /usr/local/
[root@localhost ~]# mv  redis-3.0.4 redis
[root@localhost ~]# cd redis/
[root@localhost redis]#  make  #如果编译有问题,大部分原因是包的问题
[root@localhost redis]# make install

二、修改配置文件
[root@localhost redis]# mkdir  {etc,log,bin}   #配置文件、日志文件、执行文件存放位置
[root@localhost redis]# cp /usr/local/redis/redis.conf etc/
[root@localhost redis]# cp ./src/{redis-cli,redis-server,redis-check-aof,redis-benchmark,redis-check-dump,redis-sentinel}  bin/
[root@localhost redis]# vim /usr/local/redis/etc/redis.conf
修改为:
daemonize yes    #允许后台daemon方式运行
logfile "/usr/local/redis/log/redis.log"   #日志文件的存放路径
pidfile /var/run/redis.pid  #进程文件的存放路径
bind 127.0.0.1   #监听ip地址,默认为127.0.0.1,当跨机器运行时,需修改ip地址
dir /usr/local/rdbfile   #本地数据库存放路径,编译安装默认存放在/usr/local/bin下
[root@localhost redis]# mkdir  /usr/local/rdbfile
[root@localhost redis]# touch  ./log/redis.log 

三、启动redis
[root@localhost redis]# nohup redis-server &  #放在后台使用
停止的代码为:[root@localhost redis]# redis-cli  shutdown

四、设置脚本启动
[root@localhost ~]# cd /usr/local/redis/utils
[root@localhost utils]# cp redis_init_script /etc/init.d/redis
[root@localhost utils]# vim /etc/init.d/redis
修改如下内容:
# chkconfig: 2345 90 10       #添加,否则开机自启会报错
# description: Redis is a persistent key-value database  #添加
EXEC=/usr/local/redis/bin/redis-server      #修改路径
CLIEXEC=/usr/local/redis/bin/redis-cli     #修改路径
CONF="/usr/local/redis/${REDISPORT}.conf"   #修改路径
[root@localhost utils]# cd /usr/local/redis/etc
[root@localhost etc]# mv redis.conf  6379.conf  #以端口为文件名
[root@localhost etc]# systemctl daemon-reload
[root@localhost etc]# chkconfig redis on
[root@localhost etc]# /etc/init.d/redis start

查看端口可得:

image.png

测试:
![image.png](https://img.haomeiwen.com/i8940095/b9a6c07a8593f17d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/

扩展:(六个redis可执行文件的作用)
redis-server:redis服务器的daemon启动程序;
redis-client:redis命令行操作工具;
redis-benchmark: redis性能测试工具,测试redis在系统及配置文件下的读写性能;
redis-check-aof: 更新日志检查;
redis-check-dump: 用于本地数据库库检查;
redis-sentinel: redis实例的监控管理、通知和实例失效备援服务,是redis集群的管理工具;

相关文章

  • redis3.0.4编译安装

    Redis的应用场景:缓存系统、计数器、排行榜、消息队列、实时系统,基本上社交媒体的功能都可以通过Redis实现。...

  • 【Redis】Centos6.5下安装配置Redis3.0.4

    本文主要介绍在Centos6.5下Redis3.0.4的安装和配置 一、环境准备: 操作系统:CentOS6.5 ...

  • 搭建并配置LAMP/LNMP环境

    如何编译安装软件编译安装是Linux安装软件的重要方式编译前的准备工作:./configure编译:make安装:...

  • Linux下编译Xmrig

    安装依赖 Ubuntu CentOS 安装 创建编译文件夹 编译安装 基本编译方式 静态编译方式 编译完成后使用l...

  • php 手动编译添加扩展

    在完成 php的编译安装后, 发现没有编译某此模块。手动添加安装。php源码编译安装 编译安装 在php源码包中 ...

  • 编译安装LNMP

    编译安装nginx 编译安装PHP 配置Nginx+PHP 安装MySQL

  • 编译安装LNMP2

    编译安装nginx 编译安装PHP 配置Nginx+PHP 安装MySQL

  • Centos7 安装Nginx

    一、编译安装 1、安装编译安装所需要的依赖 2、下载Nginx 3、解压 4、编译安装(默认设置) 5、查看安装目...

  • Hbuilder scss/sass编译 插件

    1. 安装插件 工具 -> 插件安装 -> scss/sass编译 -> 安装安装 scss/sass编译 插件 ...

  • nginx+passenger配置rails的生产环境

    先编译方式安装好nginx ==> 安装教程 安装passenger 编译安装,只需要在原来的编译配置参数后补上就...

网友评论

      本文标题:redis3.0.4编译安装

      本文链接:https://www.haomeiwen.com/subject/mjdaahtx.html