1.下载:
官网下载:https://redis.io/download
把安装包上传至服务器:
2.安装libevent:
解压redis:
[root@manmanda2018 ~]# cd /usr/local/soft/
[root@manmanda2018 soft]# tar -zxvf redis-4.0.9.tar.gz
进入redis-4.0.9文件夹:
[root@manmanda2018 soft]# cd redis-4.0.9
安装:
[root@manmanda2018 redis-4.0.9]# make
启动:
[root@manmanda2018 redis-4.0.9]# cd src
[root@manmanda2018 src]# ./redis-server /usr/local/soft/redis-4.0.9/redis.conf
打印启动日志:
18296:C 11 Apr 17:14:05.134 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
18296:C 11 Apr 17:14:05.134 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=18296, just started
18296:C 11 Apr 17:14:05.134 # Configuration loaded
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 18296
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
18296:M 11 Apr 17:14:05.136 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
18296:M 11 Apr 17:14:05.136 # Server initialized
18296:M 11 Apr 17:14:05.136 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
18296:M 11 Apr 17:14:05.136 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
18296:M 11 Apr 17:14:05.136 * Ready to accept connections
使用:
[root@manmanda2018 src]# ./redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379>
完结。
设置开机自启:
https://zhaoshuxiang.blog.csdn.net/article/details/109034969