zoukankan      html  css  js  c++  java
  • redis搭建实战记录

    Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can containstringshasheslistssets 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


     

    set keyget key都正确

    redis搭建测试通过 

    参考文章:

    http://redis.io/ 

    http://redis.io/topics/quickstart 

    http://hi.baidu.com/thinkinginlamp/blog/item/3358c93d174e35ce9f3d62bf.html 

    作者:yjf512(轩脉刃)

    出处:http://www.cnblogs.com/yjf512/

    本文版权归yjf512和cnBlog共有,欢迎转载,但未经作者同意必须保留此段声明

    实时了解作者更多技术文章,技术心得,请关注微信公众号“轩脉刃的刀光剑影”

    本文基于署名-非商业性使用 3.0许可协议发布,欢迎转载,演绎,但是必须保留本文的署名叶剑峰(包含链接http://www.cnblogs.com/yjf512/),且不得用于商业目的。如您有任何疑问或者授权方面的协商,请与我联系

  • 相关阅读:
    django
    水仙花数 Python
    Python 实现两个矩形重合面积
    Linux文件目录
    grep 命令
    软件测试的一些心得(转)
    压力测试和负载测试
    如何在mysql数据库生成百万条数据来测试页面加载速度
    CentOS7下部署java+tomcat+mysql项目及遇到的坑
    MongoDB的安装
  • 原文地址:https://www.cnblogs.com/yjf512/p/2358799.html
Copyright © 2011-2022 走看看