zoukankan      html  css  js  c++  java
  • 源码安装Redis

    1.官网地址下载

    猛击

    mkdir /down
    cd down
    wgit http://download.redis.io/releases/redis-3.0.7.tar.gz

     ###准备工作;安装环境

    1 sudo apt-get upgrade
    2 sudo apt-get update
    3 sudo apt-get install tcl
    4 sudo apt-get install build-essential //安装主要编译工具 gcc, g++, make 
    5 sudo apt-get install autoconf automake1.9 
    6 sudo apt-get install manpages-dev //安装C语言函数帮助文档 
    7 sudo apt-get install binutils-doc cpp-doc gcc-doc glibc-doc stl-manual //安装其他相关帮助文档 ,如C++,STL等

    2. 安装

    tar -xvf redis-3.0.7.tar.gz
    cd  redis-3.0.7
    sudo make && make test &&  sudo make install
    .....
    #提示Ok

    o/ All tests passed without errors!
    Cleanup: may take some time... OK
    make[1]:正在离开目录 `/home/kamil/down/redis-3.0.7/src'

    3.配置

    1 sudo mkdir -p /usr/local/redis/bin
    2 sudo mkdir -p /usr/local/redis/etc
    3 sudo mv ./redis.conf /usr/local/redis/etc/
    4 cd ./src
    5 sudo mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server /usr/local/redis/bin/

    4.启动

    cd /usr/local/redis/bin 
    sudo ./redis-server &

     5.验证

    kamil@ubuntu:~$ redis-cli 
    127.0.0.1:6379> set name Kamil.Liu
    OK
    127.0.0.1:6379> get name
    "Kamil.Liu"
    127.0.0.1:6379> 
    
    #远程调试
    kamil@vm-ubuntu:~$ redis-cli -h 192.168.0.160 -p 6379
    192.168.0.160:6379> set work IT
    OK
    192.168.0.160:6379> get work
    "IT"
    192.168.0.160:6379>

    6.python调试

     1 #!/usr/bin/env python
     2 # encoding: utf-8
     3 """
     4 @author: 侠之大者kamil
     5 @file: redis_test.py
     6 @time: 2016/4/7 17:38
     7 """
     8 import redis
     9 r = redis.Redis(host="192.168.0.160")
    10 r.set('age',"26")
    11 r.set('name',"Kmail.Liu")
    12 print(r.keys())
    13 print(r.get("age"))
    14 all_keys = r.keys()
    15 for k in all_keys:
    16     print(k.decode('utf-8') , r.get(k).decode('utf-8'))

    q

    公众号请关注:侠之大者
  • 相关阅读:
    ....
    CodeForces 375A(同余)
    POJ 2377 Bad Cowtractors (最小生成树)
    POJ 1258 AgriNet (最小生成树)
    HDU 1016 Prime Ring Problem(全排列)
    HDU 4460 Friend Chains(bfs)
    POJ 2236 Wireless Network(并查集)
    POJ 2100 Graveyard Design(尺取)
    POJ 2110 Mountain Walking(二分/bfs)
    CodeForces 1059B Forgery(模拟)
  • 原文地址:https://www.cnblogs.com/kamil/p/5364480.html
Copyright © 2011-2022 走看看