安装
yum install gcc-c++
# 在redis文件夹下执行make
make
make install
# redis默认的安装路径 /usr/local/bin
[root@centos redis-5.0.8]# cd /usr/local/bin/
[root@centos bin]# ls
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
拷贝配置文件
[root@centos bin]# mkdir redisconfig
[root@centos bin]# ls
redis-benchmark redis-check-aof redis-check-rdb redis-cli redisconfig redis-sentinel redis-server
[root@centos bin]# cp /usr/local/redis-5.0.8/redis.conf ./redisconfig/
启动redis
# 修改redis.conf 的 daemonize为yes(后台启动)
# 通过配置文件启动server
[root@centos bin]# ./redis-server ./redisconfig/redis.conf
# 使用redis客户端连接server
[root@centos bin]# ./redis-cli -p 6379
查看redis进程是否开启
[yuanzheng@centos ~]$ ps -ef|grep redis
root 15582 1 0 17:20 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 15594 3026 0 17:20 pts/1 00:00:00 ./redis-cli -p 6379
yuanzhe+ 15674 15627 0 17:23 pts/2 00:00:00 grep --color=auto redis
关闭redis服务
127.0.0.1:6379> shutdown
not connected> exit
[yuanzheng@centos ~]$ ps -ef|grep redis
yuanzhe+ 15693 15627 0 17:25 pts/2 00:00:00 grep --color=auto redis
redis-benchmark基准测试
[yuanzheng@centos bin]$ ./redis-benchmark -h localhost -p 6379 -c 100 -n 100000
====== SET ======
100000 requests completed in 2.30 seconds
100 parallel clients
3 bytes payload
keep alive: 1