源文件安装(推荐安装)

在CentOS系统中,首先安装EPEL仓库,然后更新yum源:

$ yum install epel-release -y
$ yum update -y
然后安装Redis数据库:

$ yum -y install redis
安装好后启动Redis服务即可:

$ systemctl start redis
这里同样可以使用redis-cli进入Redis命令行模式操作。

另外,为了可以使Redis能被远程连接,需要修改配置文件,路径为/etc/redis.conf

$ vi /etc/redis.conf
需要修改的地方:

首先,注释这一行:

#bind 127.0.0.1
另外,推荐给Redis设置密码,取消注释这一行:

#requirepass foobared

foobared即当前密码,可以自行修改为

requirepass 密码


然后重启Redis服务,使用的命令如下:

$ systemctl restart redis


$ 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服务器

 

使用说明

springboot集成

spring:
  redis:
    host: 127.0.0.1
    port: 6379
    timeout: PT60S
    database: 0
    password:

相关文章:

  • 2022-01-07
  • 2021-09-25
  • 2021-05-18
  • 2021-10-02
  • 2021-10-11
  • 2021-12-10
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2021-08-28
  • 2022-12-23
  • 2021-08-20
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案