最近一直在看redis的源代码,想着要折腾一下,就安装一下redis。
但是安装过程有些困惑。
基本流程:
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
tar zxvf redis-2.8.19.tar.gz(有些解压需要tar -zxvf redis-2.8.19.tar.gz,视系统而定)
cd redis-2.8.19
make test
make && make PREFIX=/home/work/redis install
这里/home/work/redis就是编译生成的可执行文件,redis-server,redis-benchmark等的存放位置。
默认会存在给定的这个目录下面的bin目录下,如果不存在bin目录则会创建
细心的人会发现,这里没有configure。是的,redis不需要configure来生成Makefile。
make && make PREFIX=/home/work/redis install
如果这里不
指定PREFIX就会默认安装到/usr/bin/local。
一些设置:
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
这里可以设置为yes来使之成为守护程序。
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
pidfile /var/run/redis.pid
这里可以修改/var/run/redis.pid为自己设定的路径。
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
可以修改端口。
# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
绑定任意你本机的地址。
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile ""
日志文件默认会写到/dev/null,如果需要保留,可以修改,例如logfile "/home/work/redis/log/redis.log"
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./
工作目录,业务数据会写到这里。
下面是redis的benchmark:
https://code.google.com/p/redis/wiki/Benchmarks