When I try to create a base with sqlite3
on a EFS directory, this results in an error:
$ sqlite3 foo.db
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .log stderr
sqlite> CREATE TABLE foo (int bar);
Error: disk I/O error
The Sqlite3 database in question is supposed to story meta data only and will be updated infrequently. Concurrent access is not required. However, it is required that if the process creating the Database dies, the process can be restarted on a different host and carry on where the previous instance quit.
Amazon claims that EFS is a "file system that [is] accessible to Amazon EC2 instances via a file system interface (using standard operating system file I/O APIs) and that support full file system access semantics (such as strong consistency and file locking)." Thus, I'm assuming it is fit for the task at hand.
The mount options in /etc/fstab
are:
eu-west-1a.fs-ID.efs.eu-west-1.amazonaws.com:/ /efs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0
I understand that it is often generally discouraged to put databases on NFS. However, I believe, given the language used by both Amazon and SQLite, developers will keep trying.
Update (March 6, 2017):
EFS now supports NFS v4.1 lock upgrades and downgrades:
From the docs:
Lock upgrades and downgrades: Amazon EFS returns NFS4ERR_LOCK_NOTSUPP if the client attempts to upgrade or downgrade an existing lock.
Note
Because lock upgrades and downgrades are not supported, use cases that require this feature, such as those using SQLite or IPython, are also not supported in Amazon EFS.
See:
http://docs.aws.amazon.com/efs/latest/ug/efs-ug.pdf
and also:
http://docs.aws.amazon.com/efs/latest/ug/nfs4-unsupported-features.html