Multi-tenant Django applications: altering database connection per request?

I’ve done something similar that is closest to point 1, but instead of using middleware to set a default connection Django database routers are used. This allow application logic to use a number of databases if required for each request. It’s up to the application logic to choose a suitable database for every query, and … Read more

Manage Connection Pooling in multi-tenant web app with Spring, Hibernate and C3P0

You can choose between 3 different strategies that will impact connection polling. In any case you have to provide an implementation of MultiTenantConnectionProvider. The strategy you choose will of course impact your implementation. General remark about MultiTenantConnectionProvider.getAnyConnection() getAnyConnection() is required by hibernate to collect metadata and setup the SessionFactory. Usually in a multi-tenant architecture you … Read more

Laravel: Run migrations on another database

In your app/config/database.php you have to: <?php return array( ‘default’ => ‘mysql’, ‘connections’ => array( # Our primary database connection ‘mysql’ => array( ‘driver’ => ‘mysql’, ‘host’ => ‘host1’, ‘database’ => ‘database1’, ‘username’ => ‘user1’, ‘password’ => ‘pass1’ ‘charset’ => ‘utf8’, ‘collation’ => ‘utf8_unicode_ci’, ‘prefix’ => ”, ), # Our secondary database connection ‘mysql2’ => … Read more

How to design a multi tenant mysql database [closed]

There are several approaches to multi-tenant databases. For discussion, they’re usually broken into three categories. One database per tenant. Shared database, one schema per tenant. Shared database, shared schema. A tenant identifier (tenant key) associates every row with the right tenant. MSDN has a good article on the pros and cons of each design, and … Read more

How can queues be made private/secure in RabbitMQ in a multitenancy system?

TLDR: The relevant information can be found here: https://www.rabbitmq.com/access-control.html. However, since the rabbitmq documentation is very verbose, below I will describe what seems like the only solution to locking down access to resources. Summary Virtual hosts As Michael Dillon mentions, you should start by making everything happen inside vhosts (virtual hosts) and block the generic … Read more

Creating a multi-tenant application using PostgreSQL’s schemas and Rails

Update Dec 5, 2011 Thanks to Brad Robertson and his team, there’s the Apartment gem. It’s very useful and does a lot of the heavy lifting. However, if you’ll be tinkering with schemas, I strongly suggest knowing how it actually works. Familiarize yourself with Jerod Santo’s walkthrough , so you’ll know what the Apartment gem … Read more

Why use subdomains to designate tenants in a multi-tenant web application?

There are several ways to determine tenant on HTTP level: domain – tenant is determined by whole Host header sub-domain – sub-domain part of Host header, path based – path segment, usually by prefix host.com/tenantId/… cookie based – cookie value contains tenant id (good framework encrypts this!) user based – user session or some data … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)