저는 Laravel 5.2 프레임워크를 사용하여 웹 애플리케이션을 실행하고 있으며, 세션 드라이버를 redis로 설정하여 다음과 같은 AWS 설정을 사용하고 있습니다.
- Instance-1: Running web application, with Redis configurations in .env file as follow
- Redis-host: aws-private-ip-of-instance-2
- Redis-password: NULL
- Redis-port: 6379
- Instance-2: Redis-server running with following configuration
- Bind aws-private-ip-of-instance-2 and 127.0.0.1
- Working directory /var/lib/redis with 775 permission, and ower-group is redis.
- RDB snapshot name dump.rdb with 660 permission, and ower-group is redis.
NOTE: In AWS inbound rule for port 6379 is configured for Instance-2.
모든 것이 잘 작동하지만, Redis가 RDB 파일에 데이터를 쓰려고 할 때 문제가 발생합니다. 프론트엔드에는 다음과 같은 오류 메시지가 표시됩니다.
MISCONF Redis가 RDB 스냅샷을 저장하도록 구성되어 있지만 현재 디스크에 데이터를 영구히 저장할 수 없습니다. 데이터 세트를 수정할 수 있는 명령어가 비활성화되었습니다. 오류에 대한 자세한 내용은 Redis 로그에 있습니다.
Redis 서버 로그에서는 다음과 같은 데이터를 얻을 수 있습니다.
4873:M 23 Sep 10:08:15.028 * 1 changes in 900 seconds. Saving...
4873:M 23 Sep 10:08:15.028 * Background saving started by pid 7392
7392:C 23 Sep 10:08:15.028 # Failed opening .rdb for saving: Read-only file system
4873:M 23 Sep 10:08:15.128 # Background saving error```
시도한 항목들
- Add vm.overcommit_memory = 1 to /etc/sysctl.conf, as suggested in Redis-administraition-blog
- Change path to dump.rdb file to tmp folder and change permissions to 777.