码迷,mamicode.com
首页 > 其他好文 > 详细

redis启动时警告信息去除及简单安全设置

时间:2015-09-21 15:58:26      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:redis

windows: https://github.com/MSOpenTech/redis/releases



12645:M 29 Jul 23:05:55.764 # Server started, Redis version 3.0.3

12645:M 29 Jul 23:05:55.766 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1‘ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1‘ for this to take effect.

12645:M 29 Jul 23:05:55.767 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled‘ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

12645:M 29 Jul 23:05:55.769 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

12645:M 29 Jul 23:05:55.769 * The server is now ready to accept connections on port 6379

==>

# echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf  or sysctl vm.overcommit_memory=1

# echo never > /sys/kernel/mm/transparent_hugepage/enabled

# echo "net.core.somaxconn = 511" >> /etc/sysctl.conf or  echo 511 > /proc/sys/net/core/somaxconn


启动:

[root@CentOS6 ~]# redis-server /etc/redis.conf 

12704:M 29 Jul 23:33:25.615 * Increased maximum number of open files to 10032 (it was originally set to 1024).

                _._                                                  

           _.-``__ ‘‘-._                                             

      _.-``    `.  `_.  ‘‘-._           Redis 3.0.3 (00000000/0) 64 bit

  .-`` .-```.  ```\/    _.,_ ‘‘-._                                   

 (    ‘      ,       .-`  | `,    )     Running in standalone mode

 |`-._`-...-` __...-.``-._|‘` _.-‘|     Port: 6379

 |    `-._   `._    /     _.-‘    |     PID: 12704

  `-._    `-._  `-./  _.-‘    _.-‘                                   

 |`-._`-._    `-.__.-‘    _.-‘_.-‘|                                  

 |    `-._`-._        _.-‘_.-‘    |           http://redis.io        

  `-._    `-._`-.__.-‘_.-‘    _.-‘                                   

 |`-._`-._    `-.__.-‘    _.-‘_.-‘|                                  

 |    `-._`-._        _.-‘_.-‘    |                                  

  `-._    `-._`-.__.-‘_.-‘    _.-‘                                   

      `-._    `-.__.-‘    _.-‘                                       

          `-._        _.-‘                                           

              `-.__.-‘                                               


12704:M 29 Jul 23:33:25.616 # Server started, Redis version 3.0.3

12704:M 29 Jul 23:33:25.616 * DB loaded from disk: 0.000 seconds

12704:M 29 Jul 23:33:25.616 * The server is now ready to accept connections on port 6379




Redis 未授权访问漏洞————————

漏洞描述:

 

redis 默认不需要密码即可访问,黑客直接访问即可获取数据库中所有信息,造成严重的信息泄露。

 

修复方案:

1、绑定需要访问数据库的IP

修改 redis.conf 中的 “bind 127.0.0.1” ,改成需要访问此数据库的IP地址。


bind 192.168.31.202 192.168.31.200

bind 127.0.0.1


2、设置访问密码

在 redis.conf 中找到“requirepass”字段,在后面填上你需要的密码。

 

 

注:上述两种方法修改后,需要重启redis才能生效。


本文出自 “态度决定一切” 博客,请务必保留此出处http://relearn.blog.51cto.com/2605709/1696731

redis启动时警告信息去除及简单安全设置

标签:redis

原文地址:http://relearn.blog.51cto.com/2605709/1696731

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!