修改redis 配置报错 : Swap file ".redis.conf.swp" already exists!

报错信息如下

 

E325: ATTENTION
Found a swap file by the name ".redis.conf.swp"
          owned by: root   dated: Mon Dec 23 16:08:01 2019
         file name: /opt/docker/redis/conf/redis.conf
          modified: YES
         user name: root   host name: localhost.localdomain
        process ID: 19783
While opening file "redis.conf"
             dated: Thu Dec 20 20:58:15 2018

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r redis.conf"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".redis.conf.swp"
    to avoid this message.

Swap file ".redis.conf.swp" already exists!

报错产生的原因是: 因为修改配置文件卡死了强行关闭, 然后再次编辑就出现了上面的错误!

原因: 
vim编辑是先copy一个副本编辑 然后再同步;
刚刚强行退出使得副本依旧存在, vim 编辑的时候报错.
所以删除这个.swap 副本文件即可解决问题;
.redis.conf.swp 文件以点"."开头 说明是一个隐藏文件
ls -a 或者 ll -a 列出隐藏列表
然后rm -rf 文件名删除即可

然后从新vim 编辑该文件即可解决问题.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章