首先把权限升到root
su root
sudo vi /etc/redis/redis.conf
sudo /etc/init.d/redis-server restart
root@VM-16-5-ubuntu:/home/ubuntu/redis# vi /etc/redis/redis.conf root@VM-16-5-ubuntu:/home/ubuntu/redis# /etc/init.d/redis-server restart [ ok ] Restarting redis-server (via systemctl): redis-server.service. root@VM-16-5-ubuntu:/home/ubuntu/redis# sudo /etc/init.d/redis-server status ● redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-05-11 18:37:44 CST; 7s ago Docs: http://redis.io/documentation, man:redis-server(1) Process: 27417 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS) Process: 27423 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS) Main PID: 27436 (redis-server) Tasks: 4 (limit: 2122) CGroup: /system.slice/redis-server.service └─27436 /usr/bin/redis-server *:6379 May 11 18:37:44 VM-16-5-ubuntu systemd[1]: Stopped Advanced key-value store. May 11 18:37:44 VM-16-5-ubuntu systemd[1]: Starting Advanced key-value store... May 11 18:37:44 VM-16-5-ubuntu systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such fil…r directory May 11 18:37:44 VM-16-5-ubuntu systemd[1]: Started Advanced key-value store. Hint: Some lines were ellipsized, use -l to show in full. root@VM-16-5-ubuntu:/home/ubuntu/redis# redis-cli