【Redis】内网环境下redis的离线安装

最近的一个项目需要在内网环境安装一些中间件,让我弄文档给他,干脆下一篇文章给他。

下载

刚发现redis的官网改变很多,难道是我很久没来了?直接给下载地址,下载自己需要的版本(演示版本:redis-7.2.4):https://download.redis.io/releases/
在这里插入图片描述

上传

上传没什么好说的,通过自己的方式上传到服务器,我这里是用rz命令上传。
在这里插入图片描述

安装

解压并编译,命令:

[root@localhost redis-7.2.4]# tar -zxvf redis-7.2.4.tar.gz 
[root@localhost redis-7.2.4]# cd redis-7.2.4/
[root@localhost redis-7.2.4]# make  & make install

编译后查看是否可用,命令:

[root@localhost redis-7.2.4]# ./src/redis-server 

在这里插入图片描述

如上图所示,表示可以正常启动。

配置

主要配置如下,需要配置什么就替换什么:

bind 0.0.0.0
protected-mode yes
port 6379
daemonize yes
requirepass kqgeo

通过配置文件启动:

[root@localhost redis-7.2.4]# ./src/redis-server redis.conf 
[root@localhost redis-7.2.4]# 

查看是否在指定端口启动:

[root@localhost redis-7.2.4]# lsof -i :6379
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 42403 root    6u  IPv4  74749      0t0  TCP *:6379 (LISTEN)
[root@localhost redis-7.2.4]# 

开机启动

关于开机启动的配置,之前写过一篇,这里直接引用了,地址:https://blog.csdn.net/u011561335/article/details/103600867

问题集锦

42402:C 17 Apr 2024 18:47:03.926 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. 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.

解决方案

问题原因是内存分配问题,当物理内存不足时依然能申请到内存。方案如下:

临时解决(电脑重启失效):

sysctl vm.overcommit_memory=1

永久生效,编辑配置文件vim /etc/sysctl.conf,添加以下内容:

vm.overcommit_memory = 1
  • 12
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

冰夏之夜影

赠人玫瑰,手留余香

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值