centos redis 安装和配置

前端之家收集整理的这篇文章主要介绍了centos redis 安装和配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装

  1. # install from EPEL
  2. [root@dlp ~]# yum --enablerepo=epel -y install redis

配置

  1. [root@dlp ~]# vi /etc/redis.conf
  2. # line 45: listening port
  3. port 6379
  4. # line 64: listening interface
  5. # localhost only by default
  6. # if you'd like to connect from other Hosts,
  7. # change to the own IP address or to 0.0.0.0
  8. bind 127.0.0.1
  9. # line 118: number of Databases
  10. # database ID is is assgined from 0 to (setting value - 1)
  11. databases 16
  12. # line 142: save caching Datase on Disk
  13. # the default settings below means like follows
  14. # after 900 sec if at least 1 key changed
  15. # after 300 sec if at least 10 keys changed
  16. # after 60 sec if at least 10000 keys changed
  17. # if you'd like to disable this function,comment out all lines fo "save ***" or specify [save ""]
  18. save 900 1
  19. save 300 10
  20. save 60 10000
  21. # line 392: authorization password
  22. requirepass password
  23. # line 501: alternative persistence mode ("yes" means enabled)
  24. # if enabled,Redis loses high performance but get more safety
  25. appendonly no
  26. # line 531: if enabled "appendonly yes" when wirting data on Disk
  27. # no means do not fsync by Redis (just let the OS flush the data)
  28. # appendfsync always
  29. appendfsync everysec
  30. # appendfsync no

启动

[root@dlp ~]# systemctl start redis
[root@dlp ~]# systemctl enable redis

添加端口

  1. [root@dlp ~]# firewall-cmd --add-port=6379/tcp --permanent
  2. success
  3. [root@dlp ~]# firewall-cmd --reload
  4. success

猜你在找的CentOS相关文章