Wiki source code of Multi-tenancy

Last modified by Ecaterina Moraru (Valica) on 2020/01/28

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
5 A [[multi-tenant>>]] setup (a.k.a "virtual mode", "multi-wiki" or "farm mode") allows you to have several wikis running on the same XWiki instance (i.e. in the same JVM).
7 This is implemented by having each wiki have its own schema or its own database in the DBMS (whether it's implemented as schema or databases depends on the DBMS).
9 The main advantage of multi-tenancy is performance optimization. A single XWiki instance on a physical machine (thus a single Servlet Container) will perform much better than having several XWiki instances running on the same machine, which wouldn't scale. As an example known XWiki multi-tenant instances host several hundreds to several thousands wikis on a single XWiki instance.
11 = Requirements =
13 The multi-tenancy feature is currently supported only on some [[DBMS>>]]:
15 * MySQL (using a different database for each subwiki)
16 * Oracle (using a different schema for each subwiki)
17 * HSQLDB (using a different schema for each subwiki) {{info}}Starting with XWiki 4.3{{/info}}
18 * PostgreSQL (using a different schema for each subwiki) {{info}}Starting with XWiki 5.0{{/info}} {{info}}Also note that using different databases instead of schemas is not currently supported on PostgreSQL since the JDBC driver doesn't support ##setCatalog()## for changing databases. That's because PostgreSQL connections are pointed to a specific database at connection time (see jira issue [[XWIKI-1960>>]] for details).{{/info}}
19 * [[Derby is currently not supported>>]]
21 In addition to having a supported DBMS you'll also need:
23 * To choose one instance of XWiki that has been installed on your network and that wil act as the main wiki. The database name for this wiki should be ##xwiki##. If you've still got to install the XWiki instance, please refer to [[the installation guide>>Documentation.AdminGuide.Installation.WebHome]] and install XWiki first.
24 * Admin privileges on this XWiki instance
25 * You need to be sure that the ##xwiki## user used to create the main database has the correct permissions to be able to create other schemas or databases since each subwiki will create a new schema/database. Refer to the [[Databases install guides>>Documentation.AdminGuide.Installation.InstallationWAR.WebHome||anchor="HInstallandconfigureaRelationalDatabase"]].
27 = Configuration =
29 There's no special step to take to get the multi-tenant feature since it's a builtin feature. We're providing a UI for users to make it easier to create, configure and delete sub wikis via the [[Wiki Application>>extensions:Extension.Wiki Application]] which should be installed by default. If you upgrade from an older version you can install it via the Extension Manager.
31 == Hostname based subwikis ==
33 By default subwikis are reachable via URLs having the wiki name in its path section, like ##http:~/~/**wikiname**/...##. If you want to have your subwikis recognized by the hostname, like ##http:~/~/**subwiki** you need to change the configuration on the file system:
35 * Set ##url.standard.multiwiki.isPathBased=false## in the ##WEB-INF/ file and set ##xwiki.virtual.usepath=0## in the ##WEB-INF/xwiki.cfg## file.
36 * Restart your XWiki instance
38 If you already have created subwikis with the path-based layout you might want to go through all wikis via the Wiki Index and make sure they have one alias for every hostname under which the subwiki should be reachable.
40 = Configuration prior to XWiki 5.3 =
42 Before 5.3, we're providing a different UI to manage sub wikis. For this you need to install the [[Wiki Manager Application>>extensions:Extension.Wiki Manager Application]] (see that page for installation instructions). This application will be transparently replaced with the Wiki Application when upgrading to 5.3 or later.
44 = Configuration prior to XWiki 5.0 =
46 {{info}}
47 These steps are no longer needed if you use XWiki 5.0 or newer.
48 {{/info}}
50 * Stop your XWiki instance, edit the ##WEB-INF/xwiki.cfg## file, look for the ##xwiki.virtual## property and set it to ##1##: {{code}}xwiki.virtual=1{{/code}}
51 * Restart your XWiki instance

Get Connected