Redis--(linux安装redis3.2.9--教程)

如果中间遇见问题可以加扣扣群300458205
Redis--(linux安装redis3.2.9--教程)_第1张图片
下载安装包
1、第一步上传并且解压编译源码

tar xzf redis-3.2.9.tar.gz -C ../server/
cd redis-3.2.9/
make

这里写图片描述
Redis--(linux安装redis3.2.9--教程)_第2张图片
Redis--(linux安装redis3.2.9--教程)_第3张图片
2、启动服务
Redis--(linux安装redis3.2.9--教程)_第4张图片
3、启动客户端验证
Redis--(linux安装redis3.2.9--教程)_第5张图片

远程访问服务器失败,知道下面有四种解决方案:
DENIED Redis is running in protected mode 
because protected mode is enabled, 
no bind address was specified, 
no authentication password is requested to clients.
In this mode connections are only accepted from the loopback interface. 
If you want to connect from external computers to Redis you may adopt one of the following solutions:
1) Just disable protected mode sending the command
'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis 
from the same host the server is running,
 however MAKE SURE Redis is not publicly accessible from internet if you do so.
Use CONFIG REWRITE to make this change permanent.
 2) Alternatively you can just disable the protected mode by editing the Redis configuration file,
  and setting the protected mode option to 'no', 
  and then restarting the server.
   3) If you started the server manually just for testing, 
   restart it with the '--protected-mode no' option. 
   4) Setup a bind address or an authentication password. 
   NOTE: You only need to do one of the above things in order for the server 
   to start accepting connections from the outside.


但是改了配置文件不管用,看到了如图提示信息:
这里写图片描述
Redis--(linux安装redis3.2.9--教程)_第6张图片

因为没有指定配置文件所以使用的是默认的,指定了路径然后说我刚才改的有问题,是因为我注释了bind并且设置了'--protected-mode no又设置了密码所以有问题。
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.
警告:过量使用内存设置为0!在低内存环境下,后台保存可能失败。为了修正这个问题,请在/etc/sysctl.conf 添加一项 'vm.overcommit_memory = 1' ,然后重启(或者运行命令'sysctl vm.overcommit_memory=1' )使其生效。

4-可以适当进行优化参数
vim /etc/sysctl.conf
net.core.somaxconn = 20480 #最大队列长度,应付突发的大并发连接请求,默认为128
net.ipv4.tcp_max_syn_backlog = 20480 #半连接队列长度,此值受限于内存大小,默认为1024
vm.overcommit_memory = 1
0 表示检查是否有足够的内存可用,如果是,允许分配;如果内存不够,拒绝该请求,并返回一个错误给应用程序。
1 允许分配超出物理内存加上交换内存的请求
2 内核总是返回true
sysctl -p #使参数生效

你可能感兴趣的:(职场@中间件@缓存,职场@数据库)