centos7安装redis
下载安装包
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
解压
tar xf redis-5.0.5.tar.gz
进入redis目录
cd redis-5.0.5/
编译
make
使用make命令来编译Redis 如果出现错误需要查看是否缺少gcc gcc-c++
解决方法
make MALLOC=libc
编译正常后通过make test进行测试一下
make test
\o/ All tests passed without errors!
测试后没有错误,现在安装
[root@master src]# make install
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
reids可执行文件
redis-check-aof #用于修复出问题的AOF文件
redis-sentinel #用于集群管理
redis-check-rdb #用于修复出问题的dump.rdb文件
redis-server #redis的服务端
redis-benchmark #性能测试
redis-cli #redis的客户端
redis-trib.rb #集群管理
以后台进程方式启动redis
修改redis.conf
将daemonize no 修改为yes
进入src目录,指定redis.conf文件启动
[root@master src]# ./redis-server /root/redis-5.0.5/redis.conf
49168:C 04 Sep 2019 21:18:01.265 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
49168:C 04 Sep 2019 21:18:01.265 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=49168, just started
49168:C 04 Sep 2019 21:18:01.265 # Configuration loaded
查看一下redis进程是否启动
[root@master src]# ps -aux | grep redis
root 32204 0.0 0.0 60684 2024 ? Ss Sep03 0:00 sudo -u redis redis-server /etc/redis.conf
polkitd 32454 0.1 0.0 41680 3052 ? Sl Sep03 3:34 redis-server *:6379
root 49169 0.1 0.1 153892 7648 ? Ssl 21:18 0:00 ./redis-server 127.0.0.1:6379
root 51533 0.0 0.0 112712 988 pts/2 S+ 21:19 0:00 grep --color=auto redis
安装完成,性能测试下试试
[root@master src]# redis-benchmark -n 10000 -q
PING_INLINE: 37453.18 requests per second
PING_BULK: 52910.05 requests per second
SET: 48543.69 requests per second
GET: 50761.42 requests per second
INCR: 55248.62 requests per second
LPUSH: 63694.27 requests per second
RPUSH: 62893.08 requests per second
LPOP: 53763.44 requests per second
RPOP: 57471.27 requests per second
SADD: 47169.81 requests per second
HSET: 55555.55 requests per second
SPOP: 61349.69 requests per second
LPUSH (needed to benchmark LRANGE): 49019.61 requests per second
LRANGE_100 (first 100 elements): 28985.51 requests per second
LRANGE_300 (first 300 elements): 15174.51 requests per second
LRANGE_500 (first 450 elements): 10384.22 requests per second
LRANGE_600 (first 600 elements): 8090.62 requests per second
MSET (10 keys): 34965.04 requests per second