-
One Application, Shared Database, Separate Schema
-
Offers a high degree of data isolation for security-conscious tenant.
-
Can support a virtually unlimited number of tenants per database server, with each tenant having access to their own set of tables that are grouped into individual schema created specifically for the tenant.
-
Can be offered at a low-cost since only a single server can have multiple tenant( as long as your customers will accept having their data logically co-located with that of other tenant.)
-
One Application, Shared Database, Shared Schema
-
Each tenant will be provided with a tenant identifier.
-
A given table can have records of many tenants in any order.
-
Tenant identifier column helps in identifying the records of each tenant.
-
Since multiple tenants share the same database schema, so the security on the database has to increase.
-
Ideal used case is herarchichal organisation structure (Organisation - Multiple Locations - Multiple Departments)
Current setup for work.sambaash.com, demo.sambaash.com, streamglobal.sambaash.com, sambaash.com has been setup using approach 1 (One Application, Shared Database, Separate Schema)
Application Setup for Approach 1
Comment out the db pool configuration in portal-ext and add below configuration in portal-ext.properties. Each section represent 1 data source schema. Same applies to shard names. Can add any number of datasources with corresponding shard mapping.
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/demo?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/work?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/streamglobal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/sambaash-v4?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=
shard.selector=com.liferay.portal.dao.shard.ManualShardSelector
shard.available.names=default,one,two,three
spring.configs=\
META-INF/base-spring.xml,\
\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
\
META-INF/util-spring.xml,\
\
META-INF/jpa-spring.xml,\
\
META-INF/executor-spring.xml,\
\
META-INF/audit-spring.xml,\
META-INF/cluster-spring.xml,\
META-INF/editor-spring.xml,\
META-INF/jcr-spring.xml,\
META-INF/ldap-spring.xml,\
META-INF/messaging-core-spring.xml,\
META-INF/messaging-misc-spring.xml,\
META-INF/mobile-device-spring.xml,\
META-INF/notifications-spring.xml,\
META-INF/poller-spring.xml,\
META-INF/rules-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/search-spring.xml,\
META-INF/workflow-spring.xml,\
\
META-INF/counter-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/staging-spring.xml,\
META-INF/virtual-layouts-spring.xml,\
\
META-INF/monitoring-spring.xml,\
\
#META-INF/dynamic-data-source-spring.xml,\
META-INF/shard-data-source-spring.xml,\
#META-INF/memcached-spring.xml,\
\
classpath*:META-INF/ext-spring.xml
Add the attached shard-data-source-spring.xml in tomcat-7.0.42/webapps/ROOT/WEB-INF/classes/META-INF/
Start the application server. Login and go to control panel, starting creating the portal instances with virtual host and map each instance to one of the available shards. One instance should be uniquely mapped to one shard.
Finally, restart the application server.