redis报错整理(持续更新。。。)

更新时间:2023-06-25 18:37:30 阅读: 评论:0

redis报错整理(持续更新。。。)
报错1:
查看⽇志/var/log/redis/redis.log
843:M 19 Feb 17:26:29.097 * 1 changes in 900 conds.
843:M 19 Feb 17:26:29.097 * Background saving started by pid 24809
24809:C 19 Feb 17:26:29.098 # Failed opening the RDB file nginx (in rver root dir /etc/cron.d) for saving: Permission denied【⽆法打开⽤于保存的RDB⽂件nginx(在服务器根⽬录/etc/cron.d中):权限被拒绝】
843:M 19 Feb 17:26:29.198 # Background saving error
分析:
本公司⽤的阿⾥云的redis3.2.12版本,yum⽅式部署(因为没有引⽤irpm源,所以是低版本,引⽤irpm源可以部署最新版的redis);
默认⽤的是RDB持久化,根据redis规则会⽣成⼀个.rdb快照⽂件并写⼊磁盘
思路:
⽇志中rdb快照⽂件⽆法保存,并且提⽰权限问题,
在配置⽂件中查找rdb的名字和路径
多少用英语怎么说vim /f
(237⾏) dbfilename dump.rdb    #数据库在做持久化时存储的⽂件名
(247⾏) dir /var/lib/redis            #数据持久化⽂件存放的⽬录(如果⽬录不存在,需要⼿动创建),./表⽰当前⽬录
查看⽂件权限,redis⽤户没有写的权限
# ll /var/lib/redis/
total 12
-rw-r--r-- 1 redis redis  77 Feb 13 14:54 backup.db
-rw-r--r-- 1 redis redis 672 Feb 13 14:50 dump.rdb
-rw-r--r-- 1 redis redis 168 Feb 13 22:45 root
# ll /var/lib/
drwxr-x---  2 redis  redis  4096 Feb 13 22:45 redis
修改为777权限
chmod  777  /var/lib/redis
#重新启动redis,解决
# systemctl restart redis
其他思路:
如果楼上的操作还没能解决问题,可以尝试关闭保护模式
(80⾏) protected-mode no  #no为关闭保护模式,默认是开启的,因为我的默认就是开启的没法测试,只能就此作罢
有⽹友说配置的服务需要让systemctl能识别,就必须刷新配置,使其⽣效。【然⽽亲测,表⽰不执⾏systemctl daemon-reload命令;⽤systemctl restart redis是可以使修改的配置⽂件⽣效的,猜测:也许和redis版本和部署⽅式,操作系统有关吧】
$ systemctl daemon-reload
报错2:
# Error condition on socket for SYNC: Connection refud【同步套接字错误:连接被拒绝】
* Connecting to MASTER 159.203.*.*:23128【连接到主机159.203.*.*:23128】
* MASTER <-> SLAVE sync started【主同步<->从同步开始】
分析:连接被拒绝;有关因素【配置⽂件⾥的bind参数设置;】【表⽰以上错误第⼆次出现了】
查看bind参数,表⽰没问题
#查看配置⽂件,10.0.1.1为内⽹ip【bind的意思不是绑定外部服务器的IP,⽽是绑定本机可以接受访问的IP;这是linux的⽹络安全策略管理的】
vim /f
62⾏  bind 10.0.1.1 127.0.0.1    #表⽰可以通过本机localhost和127.0.0.1和内⽹ip访问;在研发、测试环境可以考虑bind
0.0.0.0,线上⽣产环境建议绑定IP地址
因为是单机做的redis,做研发⽤的,访问redis也是通过内⽹访问,暂时不晓得为啥连接被拒。也许和以下告警有关系吧。
告警:
Running in standalone mode
# WARNING: The TCP backlog tting of 511 cannot be enforced becau /proc/sys/net/core/somaxconn is t to the lower value of 128.【警告:⽆法强制执⾏TCP backlog设置511,因为/proc/sys/net/core/somaxconn设置为较低的值128】
# Server started, Redis version 3.2.12
# WARNING overcommit_memory is t to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /f and then reboot or run the command 'sysctl
vm.overcommit_memory=1' for this to take effect.【“警告超限”内存设置为0!在内存不⾜的情况下,后台保存可能会失败。
若要解决此问题,请将“vm.overcommit_memory=1”添加到/f,然后重新启动或运⾏命令“sysctl
vm.overcommit_memory=1”以使其⽣效。】
* DB loaded from disk: 0.000 conds
* The rver is now ready to accept connections on port 6379
解决告警⼀;
临时解决:  $  echo 511 > /proc/sys/net/core/somaxconn
永久解决:  $ echo  "somaxconn= 1024" > /f
$ sysctl -p      #使其⽣效
重启redis: $  systemctl restart redis
$  systemctl restart redis
解决告警⼆:
$  echo  "vm.overcommit_memory = 1"  > /f
$ sysctl -p      #使其⽣效
重启redis: $  systemctl restart redis
$  systemctl restart redis
告警:
# 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 tting after a reboot.
简爱内容Redis must be restarted after THP is disabled.
【警告您的内核中启⽤了透明⼤页⾯(THP)⽀持。这将导致Redis的延迟和内存使⽤问题。要解决此问题,请以root⽤户⾝份运⾏命令“echo never>/sys/kernel/mm/transparent_hugepage/enabled”,并将其添加到/etc/rc.local中,以便在重新启动后保留设置。禁⽤THP后,必须重新启动Redis。】
查看该⽂件
# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvi never
添加
# echo never>/sys/kernel/mm/transparent_hugepage/enabled
# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvi [never]
并添加到/etc/rc.local
# cat /etc/rc.local
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
报错复现:
* 1 changes in 900 conds.
* Background saving started by pid 11541
# Failed opening the RDB file web (in rver root dir /etc/cron.d) for saving: Permission denied
# Background saving error
#进⼊库报错
127.0.0.1:6379> ping
黑色幼龙的缰绳(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data t are disabled. Plea check Redis logs for details about the error.
【(错误)missf Redis配置为保存RDB快照,但当前⽆法在磁盘上保留。可以修改数据集的命令被禁⽤。有关错误的详细信息,请检查Redis⽇志。】
#报错时在库⾥得到的信息
127.0.0.1:6379> info
# Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-957.5.1.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
踢毽子的好处与坏处gcc_version:4.8.5
process_id:20485
run_id:ebdd353964aa512e913fe692ddf4bb00b5a7c7a9
tcp_port:6379
面相图解大全uptime_in_conds:80174
uptime_in_days:0
hz:10
lru_clock:5188297
executable:/usr/bin/redis-rver
executable:/usr/bin/redis-rver
config_file:/f
# Clients
connected_clients:1    #连接的客户机:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
# Memory
ud_memory:812768    #已⽤内存:812768
ud_memory_human:793.72K
ud_memory_rss:3190784
ud_memory_rss_human:3.04M
ud_memory_peak:2298536    #已⽤内存峰值:2298536 ud_memory_peak_human:2.19M
total_system_memory:166********
total_system_memory_human:15.51G
ud_memory_lua:37888
ud_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:3.93
mem_allocator:jemalloc-3.6.0
等差数列是什么# Persistence
loading:0
rdb_changes_since_last_save:63
rdb_bgsave_in_progress:0
rdb_last_save_time:1582238527
rdb_last_bgsave_status:err
rdb_last_bgsave_time_c:0
rdb_current_bgsave_time_c:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_c:-1
aof_current_rewrite_time_c:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
# Stats
total_connections_received:2132
total_commands_procesd:18591
instantaneous_ops_per_c:0
total_net_input_bytes:3345698
total_net_output_bytes:1744786
时钟英文
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
披肝沥胆sync_partial_err:0
expired_keys:369
evicted_keys:0
keyspace_hits:1763

本文发布于:2023-06-25 18:37:30,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1054645.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:配置   连接   内存
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图