到官网下载最新版的 Redis-3.2.6

我把它放到文件夹:/usr/local/src/centos-sdk/source2/redis

安装脚本 redis-3.2.6.sh

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi setenforce 0 # 临时禁用,不需要重启(推荐)。 ##################################################
### 安装 工具
##################################################
yum install gcc-c++
yum install -y tcl
yum install wget ##################################################
### 安装 redis
##################################################
cd /usr/local/src/centos-sdk/source2/redis
tar -xzvf ./redis-3.2.6.tar.gz mkdir -pv /usr/local/redis/redis-3.2.6
\cp -rf ./redis-3.2.6/* /usr/local/redis/redis-3.2.6
cd /usr/local/redis/redis-3.2.6 # 测试 redis
make
cd src
make test # 配置 redis
mkdir /usr/local/redis/redis-3.2.6/etc
\cp -rf /usr/local/src/centos-sdk/config/redis-3.2.6/redis.conf /usr/local/redis/reids-3.2.6/etc/redis.conf # 开机启动(已弃用)
# echo "/usr/local/redis/redis-3.2.6/src/redis-server /usr/local/redis/redis-3.2.6/etc/redis.conf &" >> /etc/rc.local # 启动 redis(已弃用)
# /usr/local/redis/redis-3.2.6/src/redis-server /usr/local/redis/redis-3.2.6/etc/redis.conf & # 设置 redis 开机启动
\cp -rf /usr/local/src/centos-sdk/config/redis-3.2.6/redis.init /etc/rc.d/init.d/redis # 拷贝redis.init到启动目录
chmod +x /etc/rc.d/init.d/redis # 添加执行权限
chkconfig redis on # 设置开机启动 service redis start # 启动 redis

/usr/local/redis/reids-3.2.6/etc/redis.conf 内容如下:

bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis.pid
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /usr/local/redis/data
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
requirepass 52php-wenjianbao
maxclients 1024
maxmemory 1GB
maxmemory-policy allkeys-lru
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 128
hash-max-ziplist-value 1024
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

更详细的介绍:Redis-3.2.6 配置文件中文翻译

/etc/init.d/redis 文件内容如下

# chkconfig: 2345 10 90
# description: Start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 # 端口
EXEC=/usr/local/redis/redis-3.2.6/src/redis-server # 服务程序
REDIS_CLI=/usr/local/redis/redis-3.2.6/src/redis-cli # 命令行程序 PIDFILE=/var/run/redis.pid
CONF="/usr/local/redis/redis-3.2.6/etc/redis.conf" # 配置文件 case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed."
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="0" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE exists, process is not running."
else
PID=$(cat $PIDFILE)
echo "Stopping..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x $PIDFILE ]
do
echo "Waiting for Redis to shutdown..."
sleep 1
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 1
esac

延伸阅读:

Mac Pro 编译安装 Redis-3.2.3

CentOS 6.5 安装 Redis-3.2.6的更多相关文章

  1. Redis学习笔记(1)- CentOS 6.4 安装Redis

    Redis学习笔记(1)- CentOS 6.4 安装Redis 2013.10.13     学习环境 vm 10.1 + 默认.新装的干净 CentOS 6.4  64BIT系统     准备 1 ...

  2. CentOS 7.3 安装redis 4.0.2服务

    CentOS 7.3 安装redis 4.0.2服务 1.下载解压 下载地址:/home/xiaoming/ wget http://download.redis.io/releases/redis- ...

  3. centos上如何安装redis?|centos傻瓜式安装redis教程

    本文介绍centos安装redis,请不要安装2.4.3,是有问题的. 首先安装gcc yum -y install gcc yum -y install gcc-c++ yum install ma ...

  4. 如何在 CentOS 7 上安装 Redis 服务器

    大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它.编译源代码,安装二进制文件,创建.安装文件.在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就 ...

  5. CentOS 7 服务器配置--安装Redis

    #下载Redis wget -r -np -nd http://download.redis.io/releases/redis-3.2.8.tar.gz #解压文件 tar zxvf redis-3 ...

  6. [从零开始搭网站八]CentOS使用yum安装Redis的方法

    1.由于centOS官方yum源里面没有Redis,这里我们需要安装一个第三方的yum源,这里用了fedora的epel仓库 yum install epel-release 安装过程中会有让你确认的 ...

  7. CentOS 7 yum 安装redis(更简单)

    一.安装redis 1.检查是否有redis yum 源 1 yum install redis 2.下载fedora的epel仓库 1 yum install epel-release 3.安装re ...

  8. redis学习之——CentOS 6 下载安装redis

    一.检查当前环境: 安装过程中没有这些,命令,在CentOS 6,最小安装导致..如果执行完命令,Noting  to  do...字样说明环境正常. yum -y install rpm gcc w ...

  9. CentOS 7 下安装redis步骤

    1. 从redis官网下载redis源码,本例安装在/usr/opt下 [root@localhost opt]# pwd /usr/opt [root@localhost opt]# wget ht ...

  10. centos 6.5 安装 redis

    下载软件: wget wget http://download.redis.io/releases/redis-2.8.7.tar.gz 2.解压软件并编译安装: tar -zxvf redis-2. ...

随机推荐

  1. C#终于支持可选参数了!

    今天偶然看了一下C#4.0的新特性, 第一个新特性就令我兴奋不已, 曾经一度令我使用C#很不习惯的"死参数"问题终于搞定了.实在太爽了! 过去用C++, VB.NET的时候都很爽, ...

  2. SQL Check

    一款实时性能监测工具 SQL Check? 一款实时监测SQL数据库性能.实时排查的问题的免费工具. 可以实时监测20个左右的SQL关键性能指标,每个指标都已图形化动态直播形式展现. 适合DBA.数据 ...

  3. [原]CentOS7部署PostGis

    转载请注明原作者(think8848)和出处(http://think8848.cnblogs.com) 本文参考了<An almost idiot's guide to install Pos ...

  4. [LeetCode] Search a 2D Matrix 搜索一个二维矩阵

    Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...

  5. R - MQ

    1. rabbit MQ 安装 Rabbit MQ 是建立在强大的Erlang OTP平台上,因此安装Rabbit MQ的前提是安装Erlang.通过下面两个连接下载安装3.2.3 版本: 下载并安装 ...

  6. 理解javascript里的ABC--apply bind call

    一,三者共同点 js中的apply,call,bind是对于初学者比较难的概念之一,比如说我..参考几篇文章之后,统一来讲, 1.这三个函数都属于Function.prototype下面的方法,如下图 ...

  7. 练习:python 操作Mysql 实现登录验证 用户权限管理

    python 操作Mysql 实现登录验证 用户权限管理

  8. 如何在mac本上安装android sdk 避免被墙

    众所周知的原因,google的很多网站在国内无法访问,苦逼了一堆天朝程序员,下是在mac本上折腾android 开发环境的过程: 一.先下载android sdk for mac 给二个靠谱的网址: ...

  9. 【原创】自己动手写工具----签到器[Beta 2.0]

    一.前面的话 上一篇中基本实现了简单的签到任务,但是不够灵活.在上一篇自己动手写工具----签到器的结尾中,我设想了几个新增功能来提高工具的灵活程度,下面把新增功能点列出来看看: (1)新增其他的进程 ...

  10. Redis之个人简单理解

    1.什么是redis? 在过去的几年中,NoSQL数据库一度成为高并发.海量数据存储解决方案的代名词,与之相应的产品也呈现出雨后春笋般的生机.然而在众多产品中能够脱颖而出的却屈指可数,如Redis.M ...