報錯信息如下
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 編輯該文件即可解決問題.