CentOS7使用yum安装配置Redis

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>欢迎转载,转载请注明出处-VirgoArt,www.cnblogs.com

一、配置第三方源

su root
******
yum install epel-release
yum update
exit

二、安装Redis

su root
******
yum install redis
exit

三、配置Redis-Conf

su root
******
vim /etc/redis.conf

开放远程访问(加上注释#):
#bind 127.0.0.1
配置访问密码(去除注释#):
requirepass yourPassword
wq exit

四、配置防火墙

1.查看防火墙端口
firewall-cmd --list-ports
2.开启端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
3.重启防火墙
firewall-cmd --reload #重启

--------firewallsystemctl stop firewalld.service #停止
--------firewallsystemctl disable firewalld.service #禁止firewall开机启动

五、服务端命令

systemctl start redis.service #启动redis服务器
systemctl stop redis.service #停止redis服务器
systemctl restart redis.service #重新启动redis服务器
systemctl status redis.service #获取redis服务器的运行状态
systemctl enable redis.service #开机启动redis服务器
systemctl disable redis.service #开机禁用redis服务器

六、远程连接

 jedis = new Jedis(redisIP);
 jedis.auth(redisPassword);

 

posted @ 2019-03-08 16:05  VirgoArt  阅读(132)  评论(0)    收藏  举报