到官网下载最新版的 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. 用java String类的getBytes(String charsetName)和String(byte[] bytes, String charsetName)解决乱码问题

    Java中String的数据是如何存储的,查看源代码就可以知道,String的数据是存储在char[] value这样一个成员变量中的,char类型的大小在java中是2个字节 我们还知道,现在普遍使 ...

  2. Openjudge 1.13-21:最大质因子序列(每日两水)

    总时间限制:  1000ms 内存限制:  65536kB 描述 任意输入两个正整数m, n (1 < m < n <= 5000),依次输出m到n之间每个数的最大质因子(包括m和n ...

  3. C#简单的对象交互

    在对象的世界里,一切皆为对象;对象与对象相互独立,互不干涉,但在一定外力的作用下对象开始共同努力 对象交互的实例 电视机大家都有吧,依照万物皆对象的思维模式来看,电视机可以是一个类,然后电视机有一些基 ...

  4. win10+vs2013+cuda8.0+caffe

    1,首先说下环境和配置 配置: 环境:windows10,vs2013 community,cuda8.0,caffe,cudnn4 注意:先要安装好显卡驱动(我的显卡是1070),这里的例子只开通了 ...

  5. [LeetCode] Pacific Atlantic Water Flow 太平洋大西洋水流

    Given an m x n matrix of non-negative integers representing the height of each unit cell in a contin ...

  6. [LeetCode] Contains Duplicate III 包含重复值之三

    Given an array of integers, find out whether there are two distinct indices i and j in the array suc ...

  7. [LeetCode] Longest Substring Without Repeating Characters 最长无重复子串

    Given a string, find the length of the longest substring without repeating characters. For example, ...

  8. 三石推荐!把 Bootstrap 小清新带回家!

    无敌传送门:http://fineui.com/demo_pro/default.aspx?theme=bootstrap1&menu=accordion   喜欢就来赞一个! 把麻烦留给三石 ...

  9. 当div有边框图片的时候,怎么实现内部的p标签的水平和垂直居中

    <!-- 这里a.png必须是四边的框都有,限制,这个时候做里边文字的居中,首先在这个里边在套一个div悬浮(absolute或者float:left),然后在这个div(必须设宽高和margi ...

  10. 网络切片在5G中的应用

    SDNLAB君 • 16-11-25 •1509 人围观 5G和网络切片 当5G被广泛提及的时候,网络切片是其中讨论最多的技术.像KT.SK Telecom.China Mobile.DT.KDDI. ...