美文网首页
Redis部署

Redis部署

作者: 追风还是少年 | 来源:发表于2024-03-23 19:01 被阅读0次

编译安装

image.png

自 redis 6.0.0 之后,编译 redis 需要支持 C11 特性,C11 特性在 4.9 中被引入。
Centos7 默认 gcc 版本为 4.8.5,所以需要升级gcc版本。

yum -y install gcc gcc-c++ make tcl
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash

配置

Redis redis.conf配置:

#需要注释
#bind 127.0.0.1

#需要修改为no
protectmode no

# 密码,设置后访问 redis 必须输入密码
requirepass 123456

启动

启动命令:./bin/redis-server ./conf/redis.conf
本地连接命令:./bin/redis-cli -p 6379

启动的警告

  • The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

将net.core.somaxconn = 1024添加到/etc/sysctl.conf中,然后执行sysctl -p生效配置

  • 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

将vm.overcommit_memory = 1添加到/etc/sysctl.conf中,然后执行sysctl -p生效配置

  • you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue 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 thesetting after a reboot. Redis must be restarted after THP is disabled.

将echo never > /sys/kernel/mm/transparent_hugepage/enabled添加到/etc/rc.local中,然后执行source /etc/rc.local生效配置

相关文章

网友评论

      本文标题:Redis部署

      本文链接:https://www.haomeiwen.com/subject/jxkktjtx.html