deploy Redis 2.8.x on Centos 6.x

来源:互联网 发布:淘宝女装精修图教程 编辑:程序博客网 时间:2024/06/05 05:50

下载

# wget --quiet http://download.redis.io/releases/redis-2.8.24.tar.gz

安装

安装/配置过程中需要用到gcc,tcl等软件包。直接通过yum安装即可
yum groupinstall -y “development tools”
yum install -y tcl

# tar -xf redis-2.8.24.tar.gz# cd redis-2.8.24# make# make test# make install    ## 或:make PREFIX=/usr/local/redis install

配置

# utils/install_server.sh Welcome to the redis service installerThis script will help you easily set up a running redis serverPlease select the redis port for this instance: [6379] Selecting default: 6379Please select the redis config file name [/etc/redis/6379.conf]/etc/redis/6379.confPlease select the redis log file name [/var/log/redis_6379.log] /var/log/redis/6379.logPlease select the data directory for this instance [/var/lib/redis/6379] /data/redis_dataPlease select the redis executable path [/usr/local/bin/redis-server] Selected config:Port           : 6379Config file    : /etc/redis/6379.confLog file       : /var/log/redis/6379.logData dir       : /data/redis_dataExecutable     : /usr/local/bin/redis-serverCli Executable : /usr/local/bin/redis-cliIs this ok? Then press ENTER to go on or Ctrl-C to abort.Copied /tmp/6379.conf => /etc/init.d/redis_6379Installing service...Successfully added to chkconfig!Successfully added to runlevels 345!Starting Redis server...Installation successful!## 重命名启动脚本# mv /etc/init.d/redis_6379 /etc/init.d/redis

启动脚本中有一点需要作如下修改:

    status)        #PID=$(cat $PIDFILE)        #####        #if [ ! -x /proc/${PID} ]   #####        if [ ! -f $PIDFILE ]        then            echo 'Redis is not running'        else            echo "Redis is running ..."   #####        fi        ;;

常见报错

执行make命令时报错:

root@localhost:~/redis-2.8.24# makecd src && make allmake[1]: Entering directory `/root/redis-2.8.24/src'    CC adlist.o在包含自 adlist.c:34 的文件中:zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录zmalloc.h:55:2: 错误:#error "Newer version of jemalloc required"make[1]: *** [adlist.o] 错误 1make[1]: Leaving directory `/root/redis-2.8.24/src'make: *** [all] 错误 2

解决:

## 在make后加上:"MALLOC=libc",即:make MALLOC=libc