I've got a project that works fine on AWS, using ECS/fargate. The setup is composed of 3 containers, one of which runs a mysql DB.
To ensure the DB data persists beyond the container lifecycles, I created and mapped an EFS as a volume to my ECS task,
"volumes": [
{
"name": "mysql",
"efsVolumeConfiguration": {
"fileSystemId": "fs-xxxxxxxxxxxxx"
}
}
]
and then mounted that to the container definition:
"mountPoints": [
{
"sourceVolume": "mysql",
"containerPath": "/var/lib/mysql",
"readOnly": false
}
]
But here's the issue: All further deployments after this change was made have been failing because of this error from the mysql container:
[ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
From my understanding, it seems when a new deployment is pushed to ECS, the newly deployed mysql container tries to perform some actions on the file: ./ibdata1 but it's unable to. This is because the file may still be open and in use by the existing container. Is this correct?
I am not sure how to go about this. Using RDS is not an option at this point.
I can confirm all necessary read and write permissions are available on that file. I can also confirm that restarting the task (using any of the older revision) works fine. Also, the DB data is available on the EFS, as configured.
But I just can't get pass that error when I deploy afresh. I'd appreciate any help or pointers.