CentOS-7 yum 安装 redis
2019-04-04 本文已影响0人
不知不怪
1.安装yum源
yum install -y vim
yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
2.安装redis
yum install -y redis
3.修改配置文件
vim /etc/redis.conf
找到bind 127.0.0.1,把它注释掉 # bind 127.0.0.1
protected-mode yes 改成 no
4.关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
5.命令
service redis start
service redis stop
service redis restart
执行如下命令测试
service redis start
redis-cli
set gzz helloworld
get gzz
6.实例
https://github.com/gzz2017gzz/spring-boot2-example/tree/master/21-spring-boot-RedisTemplate
https://github.com/gzz2017gzz/spring-boot2-example/tree/master/22-spring-boot-Redis-session
https://github.com/gzz2017gzz/spring-boot2-example/tree/master/25-spring-boot-redis-cluster
https://github.com/gzz2017gzz/spring-boot2-example/tree/master/32-spring-boot-redis-cache