superfly / litefs

FUSE-based file system for replicating SQLite databases across a cluster of machines
Apache License 2.0
3.82k stars 93 forks source link

can I read/write database directly via pdo_sqlite in laravel with static lease? #369

Closed jasonbigl closed 1 year ago

jasonbigl commented 1 year ago

Just found fly.io and this project, it seems a perfect solution for us. Our application consists of admin panel and a few datacenter around the world, I'm considering use litefs and fly.io to replace our mysql-nosql sync.

I'm going to set our admin panel as static primary node and our datacenter around the world as read-replica, the question is can I use the laravel default sqlite driver to read/write sqlite directly? It seems the doc require to read/write via http api, which is not good for us since we don't have any laravel http-based database driver, and can't find any one in github.

Thank you.

benbjohnson commented 1 year ago

Hi @jasonbigl. Yes, you can use any regular SQLite driver with LiteFS. The HTTP API is only for LiteFS nodes to communicate with each other. Your application will access the database via the FUSE mount that LiteFS provides. You can even use the regular sqlite3 CLI on your replicated databases.