Chinaunix首页 | 论坛 | 博客
  • 博客访问: 28700
  • 博文数量: 7
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-31 15:06
个人简介

爱拼才会赢!

文章分类

全部博文(7)

文章存档

2013年(7)

我的朋友

分类: 系统运维

2013-11-21 10:06:08

redis是一个开源、支持网络、基于内存、键值对存储数据库,根据DB-Engines.com的数据显示,redis是最流行的键值对存储数据库。

点击(此处)折叠或打开

  1. wget http://redis.googlecode.com/files/redis-2.6.16.tar.gz
  2. sudo tar xzvf redis-2.6.16.tar.gz -C /usr/local/
  3. cd /usr/local/redis-2.6.16/src
  4. sudo make test


make test执行时出现的问题:You need tcl 8.5 or newer in order to run the Redis test
解决方法:安装tcl 8.6



点击(此处)折叠或打开


  1. sudo wget http://downloads.sourceforge.net/tcl/tcl8.6.0-src.tar.gz
  2. sudo tar xzvf tcl8.6.0-src.tar.gz -C /usr/local/
  3. cd /usr/local/tcl8.6.0/unix/
  4. sudo ./configure
  5. sudo make
  6. sudo make install
  7. 测试:sudo make shell(exit退出)
继续安装redis:

点击(此处)折叠或打开

  1. sudo make test
  2. 出现“\o/ All tests passed without errors!”表示成功!
  3. 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.

安装警告提示,即可解决问题:

     

点击(此处)折叠或打开

  1. 在/etc/sysctl.conf中添加vm.overcommit_memory = 1
  2. sudo sysctl vm.overcommit_memory=1

点击(此处)折叠或打开

  1. sudo make install 会在redis的安装目录的bin目录下生成一些redis命令
  2. ls /usr/local/bin/
  3. cd ../utils/
  4. sudo ./install_server.sh 使用默认的即可
  5. Please select the redis port for this instance: [6379] 6379
  6. Please select the redis config file name [/etc/redis/6379.conf]
  7. Selected default - /etc/redis/6379.conf
  8. Please select the redis log file name [/var/log/redis_6379.log]
  9. Selected default - /var/log/redis_6379.log
  10. Please select the data directory for this instance [/var/lib/redis/6379]
  11. Selected default - /var/lib/redis/6379
  12. Please select the redis executable path [/usr/local/bin/redis-server]

  13. 启动、关闭redis
  14. sudo /etc/init.d/redis_6379 stop
  15. sudo netstat -tunlp | grep redis
  16. sudo /etc/init.d/redis_6379 start
  17. sudo netstat -tunlp | grep redis

redis到此就安装成功!



阅读(220) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~