Redis 3.2.4编译安装
Posted 烟花^_^
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Redis 3.2.4编译安装相关的知识,希望对你有一定的参考价值。
1. 下载安装包
wget url
tar zxvf redis-3.2.4.tar.gz
2. 编译安装
cd redis-3.2.4/src/
sudo make && make install
3. redis创建启动文件
cd /usr/local/redis-3.2.4
cp redis.conf /etc/
4. 添加启动配置文件
touch /etc/init.d/redis
chmod 755 /etc/init.d/redis
vim /etc/init.d/redis
内容如下
#!/bin/bash
#
# Init file for redis
#
# chkconfig: - 80 12
# description: redis daemon
#
# processname: redis
# config: /etc/redis.conf
# pidfile: /var/run/redis.pid
source /etc/init.d/functions
BIN="/usr/local/bin"
CONFIG="/etc/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
5. 修改配置文件 /etc/redis.conf
daemonize yes修改为yes
bind 127.0.0.1(指定访问IP)
修改端口为6899(默认为6379)
开启密码requirepass
6. 启动redis
/etc/init.d/redis start
以上是关于Redis 3.2.4编译安装的主要内容,如果未能解决你的问题,请参考以下文章