The Luna database architecture is based on a master-slave replication model, where one node acts as the primary (master) node, and one or more nodes act as replicas (slaves). This architecture provides high availability and scalability, as well as support for online backups and upgrades.
The "database" exists physically on the hard drives of full nodes. A full node stores the complete history of the blockchain. When a user queries their Luna balance, they are asking a full node to search its local copy of the ledger.