tar -zxvf redis-5.0.3.tar.gz -C /usr/local
yum install gcc
cd /usr/local/redis-5.0.3
make MALLOC=libc
cd src && make install
出现以下提示:
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
cd src
./redis-server
出现以下界面:
[root@iZwz991stxdwj560bfmadtZ src]# ./redis-server
18685:C 13 Dec 12:56:12.507 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
18685:C 13 Dec 12:56:12.507 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=18685, just started
18685:C 13 Dec 12:56:12.507 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.6 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 18685
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
18685:M 13 Dec 12:56:12.508 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
18685:M 13 Dec 12:56:12.508 # Server initialized
18685:M 13 Dec 12:56:12.508 # 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.
18685:M 13 Dec 12:56:12.508 # 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.
18685:M 13 Dec 12:56:12.508 * Ready to accept connections
如上图:redis启动成功,但是这种启动方式需要一直打开窗口,不能进行其他操作,不太方便。 按 ctrl + c可以关闭窗口。但是这样也同时关闭了redis服务。
cd /usr/local/redis-5.0.3
vim redis.conf
修改以下配置:
bind 0.0.0.0
daemonize yes
/*设置redis的访问密码*/
requirepass abc12345
ps -ef | grep redis
root 18835 1 0 11:49 ? 00:00:00 ./redis-server 0.0.0.0:6379
root 18908 18854 0 11:55 pts/1 00:00:00 grep --color=auto redis
kill 18835
cd /usr/local/redis-5.0.3/src
./redis-server ../redis.conf

[root@master src]# ./redis-cli -h 192.168.128.128 -p 6379 -a abc12345
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.128.128:6379>
[root@master redis]# redis-cli shutdown