设为首页 收藏本站
查看: 3430|回复: 0

[经验分享] redis搭建实战记录

[复制链接]

尚未签到

发表于 2015-7-20 07:24:03 | 显示全部楼层 |阅读模式
Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can containstrings, hashes, lists, sets and sorted sets.     -- from http://redis.io/
  
redis 是一个基于内存的高性能key-value数据库,数据都保存在内存中定期刷新到磁盘,以极高的读写效率而备受关注。他的特点是支持各种数据结构,stirng,hashes, list,set,和sorted sets  client端对于不同数据结构是使用不同的命令
  
  这里说一下redis的安装
  虚拟机环境: centos
  

  1 wget  make 安装

  wget http://download.redis.io/redis-stable.tar.gz
  tar xvzf redis-stable.tar.gz
  cd redis-stable
  make
  
  注: 这里记录一下我安装过程中出现的问题:
  make: Warning: File `Makefile' has modification time 5.4e+06 s in the future
  cd src && make all
  make[1]: Entering directory `/redis/redis-2.4.7/src'
  make[1]: Warning: File `Makefile' has modification time 5.4e+06 s in the future
  MAKE hiredis
  make[2]: Entering directory `/redis/redis-2.4.7/deps/hiredis'
  make[2]: Warning: File `Makefile' has modification time 5.4e+06 s in the future
  cc -c -std=c99 -pedantic -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings    -g -ggdb  net.c
  make[2]: cc: Command not found
  make[2]: *** [net.o] Error 127
  make[2]: Leaving directory `/redis/redis-2.4.7/deps/hiredis'
  make[1]: *** [dependencies] Error 2
  make[1]: Leaving directory `/redis/redis-2.4.7/src'
  make: *** [all] Error 2
  
  
  第一个问题
  make: Warning: File `Makefile' has modification time 5.4e+06 s in the future
  系统时间调整错了,调过来就好了
  
  第二个问题:
  make[2]: Entering directory `/redis/redis-2.4.7/deps/hiredis'
  cc -c -std=c99 -pedantic -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings    -g -ggdb  net.c
  make[2]: cc: Command not found
  没安装gcc,
  yum install gcc-c++
  
  第三个问题:
  make的时候显示
  make[1]: Entering directory `/redis/redis-2.4.7/src'
  which: no tclsh8.5 in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
  You need 'tclsh8.5' in order to run the Redis test
  没安装tcl
  按照官网http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html 上的安装
  
  安装完成之后,make成功!
  
  安装成功之后会在src文件夹内有redis-server和redis-cli两个命令
  建议将其放到bin下
  sudo cp redis-server /usr/local/bin/
  sudo cp redis-cli /usr/local/bin/
  
  
  好了,现在redis就安装成功了
  
  2 测试redis安装情况
  我只在一台虚拟机上安装了redis,所以这台虚拟机既是服务器,又是客户端
  测试:
  
  1 使用secureRt打开一个会话,redis-server,让其作为服务器运行
  [19282] 19 Feb 23:52:57 - 1 clients connected (0 slaves), 726248 bytes in use
  [19282] 19 Feb 23:53:02 - DB 0: 1 keys (0 volatile) in 4 slots HT.
  [19282] 19 Feb 23:53:02 - 1 clients connected (0 slaves), 726248 bytes in use
  [19282] 19 Feb 23:53:07 - DB 0: 1 keys (0 volatile) in 4 slots HT.
  [19282] 19 Feb 23:53:07 - 1 clients connected (0 slaves), 726248 bytes in use
  
  2 打开另一个会话:
  ast login: Tue Feb 19 22:49:49 2013 from 192.168.1.103
DSC0000.png

  
  set key和get key都正确
    redis搭建测试通过
  
  参考文章:
  http://redis.io/
  http://redis.io/topics/quickstart
  http://hi.baidu.com/thinkinginlamp/blog/item/3358c93d174e35ce9f3d62bf.html
  
  作者:yjf512(轩脉刃)  
  出处:http://www.iyunv.com/yjf512/  
  本文版权归yjf512和cnBlog共有,欢迎转载,但未经作者同意必须保留此段声明

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-88360-1-1.html 上篇帖子: 高性能网站架构设计之缓存篇(1)- Redis的安装与使用 下篇帖子: ServiceStack.Redis的PooledRedisClientManager蛋痛的设计
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表