1、安装需要的支持环境
在安装Redis之前首要先做的是安装Unix的Tcl工具,如果不安装的话后期将无法对Redis进行测试。在后期执行make test的时候返回如下错误信息:You need tcl 8.xuyao de5 or newer in order to run the Redis test,具体的流程为:
cd /usr/local/src wget http://downloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gz tar -zxvf tcl8.6.3-src.tar.gz cd tcl8.6.3/unix/ ./configure make make install |
2、安装redis
安装redis的过程非常的简单,具体教程官网也有。具体如下:http://redis.io/download
cd /usr/local/src wget http://download.redis.io/releases/redis-2.8.19.tar.gz tar zxvf redis-2.8.19.tar.gz cd redis-2.8.19 make make PREFIX=/usr/local/redis install |
其中PREFIX=/usr/local/redis可以省略,省略情况下redis会默认安装到/usr/local/bin目录下。
3、测试Redis
cd src make test |
通过以上命令就要可以对redis进行加大的测试。
4、配置redis
A、复制并修改配置文档
cp ./redis.conf /usr/local/redis/ vim /usr/local/redis/redis.conf |
我只修改了如下两项:
daemonize yes #redis将以守护进程的方式运行,默认为no会暂用你的终端
timeout 300 #当 客户端闲置多长时间后关闭连接,如果指定为0,表示关闭该功能
更多的配置内容,后续梳理完成后再发布出来。
B、设置自动启动
vim /etc/init.d/redis |
文件中保存如下内容:
#!/bin/sh # # redis Startup script for Redis Server # # chkconfig: - 80 12 # description: Redis is an open source, advanced key-value store. # # processname: redis-server # config: /etc/redis.conf # pidfile: /var/run/redis.pid source /etc/init.d/functions BIN="/usr/local/redis/bin" CONFIG="/usr/local/redis/redis.conf" PIDFILE="/var/run/redis.pid" ### Read configuration [ -r "$SYSCONFIG" ] && source "$SYSCONFIG" RETVAL=0 prog="redis-server" desc="Redis Server" start() { if [ -e $PIDFILE ];then echo "$desc already running...." exit 1 fi echo -n $"Starting $desc: " daemon $BIN/$prog $CONFIG RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog return $RETVAL } stop() { echo -n $"Stop $desc: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $PIDFILE return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; condrestart) [ -e /var/lock/subsys/$prog ] && restart RETVAL=$? ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" RETVAL=1 esac exit $RETVAL |
C、启动或关闭服务
service redis start
service redis stop |
5、使用redis
[root@localhost redis]# cd /usr/local/redis/bin [root@localhost bin]# ./redis-cli 127.0.0.1:6379> set foo bar OK 127.0.0.1:6379> get foo "bar" 127.0.0.1:6379> |
相关推荐
CentOS安装Redis,单机安装Redis,redis主从模式,sentinel模式,集群模式安装详解
NULL 博文链接:https://jayceyxc.iteye.com/blog/2258811
centos 安装redis.docx、亲测可以使用
5、centos安装redis
资源包括(Redis集群安装及配置规范,redis集群常用操作 )
Centos安装Redis的所有材料,高级篇
NULL 博文链接:https://hao3721.iteye.com/blog/1913507
详细介绍了在centos操作系统下怎么安装redis 开启redis防火墙
centos下安装redis6.2.7,并进行集群环境搭建
redis安装
安装与配置Redis文档:https://www.jianshu.com/p/2f95680f21c5安装Redis首先拉取镜像,从镜像库里选版本,这里安装5.
CentOS7下安装搭建Redis-4.0.6的详细过程,有具体的截图说明过程。其中还包含Redis客户端是在Win下搭建,可以连接Redis服务,实现程序测试查看。 tar.gz、exe等包已经包含
最新linux下centOS7 安装redis教程!!!!!!!!!!!!!!!!
centos7 安装Redis 与 Redis解决session共享,可根据文档进行安装和使用,本人调试过,没问题
主要介绍了CentOS 安装redis和MySQL的相关资料,需要的朋友可以参考下
centos源码安装redis-3.2.11
CentOS7.5 安装Redis集群,已经在生成环境使用 CentOS7.5 安装Redis集群,已经在生成环境使用
centos下redis可视化界面
1、安装epel-release (建议使用国内阿里云源) #下载wget,备份当前源 yum install wget -y mv /etc/yum.repo.d/*.repo /tmp #下载阿里云源和epel源 wget -O /etc/yum.repos.d/CentOS-Base.repo ...
Linux centos7安装redis,并开启aof持久化模式