安装

    1. yum install gcc-c++
    2. # 在redis文件夹下执行make
    3. make
    4. make install
    5. # redis默认的安装路径 /usr/local/bin
    6. [root@centos redis-5.0.8]# cd /usr/local/bin/
    7. [root@centos bin]# ls
    8. redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server

    拷贝配置文件

    1. [root@centos bin]# mkdir redisconfig
    2. [root@centos bin]# ls
    3. redis-benchmark redis-check-aof redis-check-rdb redis-cli redisconfig redis-sentinel redis-server
    4. [root@centos bin]# cp /usr/local/redis-5.0.8/redis.conf ./redisconfig/

    启动redis

    1. # 修改redis.conf 的 daemonize为yes(后台启动)
    2. # 通过配置文件启动server
    3. [root@centos bin]# ./redis-server ./redisconfig/redis.conf
    4. # 使用redis客户端连接server
    5. [root@centos bin]# ./redis-cli -p 6379

    查看redis进程是否开启

    1. [yuanzheng@centos ~]$ ps -ef|grep redis
    2. root 15582 1 0 17:20 ? 00:00:00 ./redis-server 127.0.0.1:6379
    3. root 15594 3026 0 17:20 pts/1 00:00:00 ./redis-cli -p 6379
    4. yuanzhe+ 15674 15627 0 17:23 pts/2 00:00:00 grep --color=auto redis

    关闭redis服务

    1. 127.0.0.1:6379> shutdown
    2. not connected> exit
    3. [yuanzheng@centos ~]$ ps -ef|grep redis
    4. yuanzhe+ 15693 15627 0 17:25 pts/2 00:00:00 grep --color=auto redis

    redis-benchmark基准测试

    1. [yuanzheng@centos bin]$ ./redis-benchmark -h localhost -p 6379 -c 100 -n 100000
    2. ====== SET ======
    3. 100000 requests completed in 2.30 seconds
    4. 100 parallel clients
    5. 3 bytes payload
    6. keep alive: 1