Hello! Some questions for the Xwiki pros!
I just installed XWiki using the Debian method (so much easier than manual or WAR deployment) on a brand new server to move away from an old server.
When I configured the xwiki files (xwiki.cfg, xwiki.properties), and specified the database parameters in “hibernate.cfg.xml” I was surprised that Xwiki came up with ALL of my data. At this point, the datastore (permanent directory) on the new server was empty!
The database I used for the new Xwiki server is a CLONE of the old database (clone done in MySQL CLI).
Then I copied (rsync -av) the permanent directory from the old server to the new one and restarted tomcat.
Because Xwiki on the new server came up with all my data (while the permanent directory was empty), I assumed that it relies only on database for storage needs (at least in my case)…
Strange thing is, on the old server, the permanent directory (as specified in xwiki.properties) contains the following data so clearly the old xwiki stored data in it…
drwxr-xr-x 3 apache apache 3 Jun 29 2020 1593450338908-0
drwxr-xr-x 3 apache apache 3 Jun 30 2020 1593545080442-0
drwxr-xr-x 4 apache apache 4 Jun 30 2020 1593546464788-0
drwxr-xr-x 4 apache apache 4 Jun 30 2020 1593546464799-0
drwxr-xr-x 4 apache apache 4 Jun 30 2020 1593546909871-0
drwxr-xr-x 3 apache apache 3 Jun 30 2020 1593546911418-0
drwxr-xr-x 3 apache apache 3 Jul 13 2020 cache
drwxr-xr-x 4 apache apache 4 Jul 13 2020 extension
drwxr-xr-x 3 apache apache 3 Jul 13 2020 jobs
drwxr-xr-x 5 apache apache 6 Jul 13 2020 solr
drwxr-xr-x 2 apache apache 2 Aug 17 2020 storage
Question 1: Am I correct to say that xwiki stores data in the mariadb DB instead of the permanent dir?
Question 2: Is it generally better to use disk storage or database storage? I have in mind data integrity and performance. I do daily rsnapshot backups of disk storage as well as mysqldump backups to a remote server.
Question 3: If disk storage is preferable (permanent directory), how can I ensure that xwiki is really using the permanent dir to store wiki data? The old server was configured with a permanent dir, but with the above experience, I am no longer certain of anything… Also, I just checked, and the contents of permanent dir on new server have the exact same timestamps as the data on the old server so clearly xwiki is not using the permament dir…
These are the parameters on the new server
/etc/xwiki/xwiki.cfg (truncated commented out lines to make post smaller)
#---------------------------------------
# Storage
#
#-# Role hints that differentiate implementations of the various storage components. To add a new implementation for
#-# one of the storages, implement the appropriate interface and declare it in a components.xml file (using a role-hint
#-# other than 'default') and put its hint here.
[...]
#-# [Since 1.6M1]
#-# Force the database name for the main wiki.
xwiki.db=xwikidb
#-# [Since 1.6M1]
#-# Add a prefix to all databases names of each wiki.
# xwiki.db.prefix=
/etc/xwiki/xwiki.properties
#-------------------------------------------------------------------------------------
# Environment
#-------------------------------------------------------------------------------------
#-# [Since 3.5M1, replaces the container.persistentDirectory property]
#-# The directory used to store persistent data (data that should persist across server restarts). This is an
#-# important directory containing important data and thus it should never be deleted (it should be backed-up along
#-# with the database).
#-# For example this is where the Extension Manager stores downloaded extensions if the extension.localRepository
#-# property isn't configured.
#-#
#-# You can set:
#-# * an absolute path (recommended)
#-# * a relative path (not recommended at all)but in this case the directory will be relative to where the XWiki server
#-# is started and thus the user under which XWiki is started will need write permissions for the current directory
#-#
#-# Note if the system property xwiki.data.dir is set then this property is not used.
#-# If neither the system property nor this configuration value here are set then the Servlet container's temporary
#-# directory is used; This is absolutely not recommended since that directory could be wiped out at any time and you
#-# should specify a value.
environment.permanentDirectory = /mnt/data/xwiki-data/
Last question: In addition to configuring hibernate.cfg.xml to connect to the remote mariadb server, I had to specify the database name in xwiki.cfg otherwise tomcat was complaining that the defaut database (xwiki) could not be reached on localhost (access denied for user ‘xwiki’@‘localhost’). Of course this happened as the database server is remote.
Why were the settings of hibernate.cfg.xml not sufficient? On the old server I have not specified anything in xwiki.cfg…
xwiki.cfg
#-# [Since 1.6M1]
#-# Force the database name for the main wiki.
xwiki.db=xwikidb
hibernate.cfg.xml
< property name=“hibernate.connection.url”>jdbc:mariadb://database.localdomain/xwikidb?useSSL=false
< property name=“hibernate.connection.username”>xwikidb
< property name=“hibernate.connection.password”>XXXXXXXXXXXXXXXXXXx
< property name=“hibernate.connection.driver_class”>org.mariadb.jdbc.Driver
< property name=“hibernate.dbcp.poolPreparedStatements”>true
< property name=“hibernate.dbcp.maxOpenPreparedStatements”>20