redis是一个开源、支持网络、基于内存、键值对存储数据库,根据DB-Engines.com的数据显示,redis是最流行的键值对存储数据库。
-
wget http://redis.googlecode.com/files/redis-2.6.16.tar.gz
-
sudo tar xzvf redis-2.6.16.tar.gz -C /usr/local/
-
cd /usr/local/redis-2.6.16/src
-
sudo make test
make test执行时出现的问题:You need tcl 8.5 or newer in order to run the Redis test
解决方法:安装tcl 8.6
-
-
sudo wget http://downloads.sourceforge.net/tcl/tcl8.6.0-src.tar.gz
-
sudo tar xzvf tcl8.6.0-src.tar.gz -C /usr/local/
-
cd /usr/local/tcl8.6.0/unix/
-
sudo ./configure
-
sudo make
-
sudo make install
-
测试:sudo make shell(exit退出)
继续安装redis:
-
sudo make test
-
出现“\o/ All tests passed without errors!”表示成功!
-
sudo ./redis-server /usr/local/redis-2.6.11/redis.conf
在启动redis时,出现以下警告信息:
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
安装警告提示,即可解决问题:
-
在/etc/sysctl.conf中添加vm.overcommit_memory = 1
-
sudo sysctl vm.overcommit_memory=1
-
sudo make install 会在redis的安装目录的bin目录下生成一些redis命令
-
ls /usr/local/bin/
-
cd ../utils/
-
sudo ./install_server.sh 使用默认的即可
-
Please select the redis port for this instance: [6379] 6379
-
Please select the redis config file name [/etc/redis/6379.conf]
-
Selected default - /etc/redis/6379.conf
-
Please select the redis log file name [/var/log/redis_6379.log]
-
Selected default - /var/log/redis_6379.log
-
Please select the data directory for this instance [/var/lib/redis/6379]
-
Selected default - /var/lib/redis/6379
-
Please select the redis executable path [/usr/local/bin/redis-server]
-
-
启动、关闭redis
-
sudo /etc/init.d/redis_6379 stop
-
sudo netstat -tunlp | grep redis
-
sudo /etc/init.d/redis_6379 start
-
sudo netstat -tunlp | grep redis
redis到此就安装成功!
阅读(220) | 评论(0) | 转发(0) |