redis突然停电导致aof文件损坏

问题: 系统部署到客户服务器上面,客户把服务器重启,导致redis的aof文件损坏,启动不了 解决: 查看日志文件,发现报错

~]# vim  /ww/server/redis.log
[2716] 28 Apr 10:17:27.915  Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>
备份aof文件,在用redis-check-aof工具修复:
~]# cp /www/server/edis/data/appendonly.aof cp /www/server/edis/data/appendonly.aofbak
~]# /www/server/redis/bin/redis-check-aof --fix /www/server/edis/data/appendonly.aof
Continue? [y/N]: y

READ MORE

rsync

服务端

1.配置/etc/rsyncd.conf

添加配置

[mygin]

path=/www/mygin/

read only = no

list = no

auth users = dong

secrets file = /etc/rsyncd.password

  1. 密码文件,xx:xxxx,用户名:密码,权限600

  2. 不配置gid默认用户nobody,需要配置的pat是nobody用户

  3. 关闭selinux

/etc/selinux/config

SELINUX=permissive

客户端

  1. 添加密码文件/Users/zuoerdong/goproject/mygin/a.txt,内容只有密码,不包括用户名:,权限600

2. rsync -av  –password-file=/Users/zuoerdong/goproject/mygin/a.txt /Users/zuoerdong/goproject/mygin/* dong@10.1.3.86::mygin

rsync -a –delete –password-file=/etc/rsync199.password ./ ouyang@10.2.1.199::5i5j-crond

不能用./*,保持目录结构,不会多套一层

-a:表示以归档模式同步文件,相当于 参数的缩写。这个选项会保留文件的元数据(如所有者、权限、时间戳等)以及其他有用的信息,例如符号链接和设备文件。-rlptgoD

-v:表示启用详细模式,输出同步过程中的详细信息。

-z:表示使用压缩算法进行传输,可以减少数据传输量。在网络较慢或传输大文件时特别有用。

因此, 命令可以将文件或目录以归档模式进行同步,并在同步过程中输出详细信息,同时使用压缩算法减少传输量。rsync -avz

————————————————

版权声明:本文为CSDN博主「HanLongXia」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/HanLongXia/article/details/129939775

READ MORE

sed替换

sed -i 's/[http:///git@/g](http:///git@/g)' */.git/config

READ MORE

siyuan笔记docker

sudo docker run –name siyuan -v ~/siyuan:/siyuan/workspace -p 6806:6806 b3log/siyuan –workspace=/siyuan/workspace/ –accessAuthCode=xxxxxx

READ MORE