【Chapter-8】生产环境部署

【Chapter-8】生产环境部署

生产环境部署

设置linux环境

  1. 设置下列与内存相关的内核参数

[root@wms-redis-test-1 redis]# sysctl vm.overcommit_memory vm.swappiness
vm.overcommit_memory = 0
vm.swappiness = 30
[root@wms-redis-test-1 redis]# sysctl -w vm.overcommit_memory=1
vm.overcommit_memory = 1
[root@wms-redis-test-1 redis]# sysctl -w vm.swappiness=0
vm.swappiness = 0
[root@wms-redis-test-1 redis]# echo vm.overcommit_memory=1 >> /etc/sysctl.conf 
[root@wms-redis-test-1 redis]# echo vm.swappiness=0 >> /etc/sysctl.conf
[root@wms-redis-test-1 redis]# sysctl vm.overcommit_memory vm.swappiness       
vm.overcommit_memory = 1
vm.swappiness = 0
  1. 禁用透明大页功能

  1. 网络参数优化

  1. 设置可以打开的最大文件数量

redis安全

redis的安全非常有限,大部分依赖redis之外(操作系统,防火墙)的机制,redis的设计思想是它将部署在所有客户端都可信的环境中。 redis更侧重极限性能和简洁性,没有考虑支持完整的身份验证和访问控制。但是我们仍然可以做一些事情来保护redis服务器以免受非法的访问和攻击

配置客户端连接选项redis.conf

配置内存策略

Last updated

Was this helpful?