CentOS 6.5 安装 Redis-3.2.6
到官网下载最新版的 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
延伸阅读:
CentOS 6.5 安装 Redis-3.2.6的更多相关文章
- Redis学习笔记(1)- CentOS 6.4 安装Redis
Redis学习笔记(1)- CentOS 6.4 安装Redis 2013.10.13 学习环境 vm 10.1 + 默认.新装的干净 CentOS 6.4 64BIT系统 准备 1 ...
- CentOS 7.3 安装redis 4.0.2服务
CentOS 7.3 安装redis 4.0.2服务 1.下载解压 下载地址:/home/xiaoming/ wget http://download.redis.io/releases/redis- ...
- centos上如何安装redis?|centos傻瓜式安装redis教程
本文介绍centos安装redis,请不要安装2.4.3,是有问题的. 首先安装gcc yum -y install gcc yum -y install gcc-c++ yum install ma ...
- 如何在 CentOS 7 上安装 Redis 服务器
大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它.编译源代码,安装二进制文件,创建.安装文件.在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就 ...
- CentOS 7 服务器配置--安装Redis
#下载Redis wget -r -np -nd http://download.redis.io/releases/redis-3.2.8.tar.gz #解压文件 tar zxvf redis-3 ...
- [从零开始搭网站八]CentOS使用yum安装Redis的方法
1.由于centOS官方yum源里面没有Redis,这里我们需要安装一个第三方的yum源,这里用了fedora的epel仓库 yum install epel-release 安装过程中会有让你确认的 ...
- CentOS 7 yum 安装redis(更简单)
一.安装redis 1.检查是否有redis yum 源 1 yum install redis 2.下载fedora的epel仓库 1 yum install epel-release 3.安装re ...
- redis学习之——CentOS 6 下载安装redis
一.检查当前环境: 安装过程中没有这些,命令,在CentOS 6,最小安装导致..如果执行完命令,Noting to do...字样说明环境正常. yum -y install rpm gcc w ...
- CentOS 7 下安装redis步骤
1. 从redis官网下载redis源码,本例安装在/usr/opt下 [root@localhost opt]# pwd /usr/opt [root@localhost opt]# wget ht ...
- centos 6.5 安装 redis
下载软件: wget wget http://download.redis.io/releases/redis-2.8.7.tar.gz 2.解压软件并编译安装: tar -zxvf redis-2. ...
随机推荐
- [转]OAuth 2.0 - Authorization Code授权方式详解
本文转自:http://www.cnblogs.com/highend/archive/2012/07/06/oautn2_authorization_code.html I:OAuth 2.0 开发 ...
- CANopen学习——感性认知
看不懂的知识硬着头皮也要看.读了当时虽然不理解,但脑子里对其相关名词.概念有印象,继续看下去,多读几遍,一定会在某个地方顿悟. CAN总线只是定义了物理层和数据链路层,并没有定义应用层.这么优秀的总 ...
- Struts2中的Ognl
OGNL(Object-Graph Navigation Language)全称为对象图导航语言,是一种功能强大的表达式语言,它通过简单一致的语法,可以任意存取对象的属性或者调用对象的方法,能够遍历整 ...
- Linux计划任务.md
crond crond是linux下用来周期性的执行某种任务或等待处理某些事件的一个守护进程,与windows下的计划任务类似,当安装完成操作系统后,默认会安装此服务工具,并且会自动启动crond进程 ...
- OSG3.40 编译时,无法打开输入文件“optimized.lib”
解决方案: 正常情况下,下图中会多出一项:ZLIB_LIBRARY_RELEASE,之后屡次编译,都提示"无法打开输入文件"optimized.lib"" 因为 ...
- 搭建一套自己实用的.net架构(3)【ORM-Dapper+DapperExtensions】
现在成熟的ORM比比皆是,这里只介绍Dapper的使用(最起码我在使用它,已经运用到项目中,小伙伴们反馈还可以). 优点: 1.开源.轻量.小巧.上手容易. 2.支持的数据库还蛮多的, Mysql,S ...
- [LeetCode] Sparse Matrix Multiplication 稀疏矩阵相乘
Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is ...
- [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal 由先序和中序遍历建立二叉树
Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that ...
- Linux常用获取进程占用资源情况手段
测试环境:Ubuntu14.04 1. 获取进程ID号 ps -aux | grep your_process_name 例如: xxx@xxx:~$ ps -e |grep Midlet|awk ...
- jq封装淘宝图片轮播插件
<!DOCTYPE html><head><meta http-equiv="Content-Type" content="text/htm ...