Hi,
I am new to PIWIK . I would like to know if there exists a possibility of having multiple DBs for PIWIK, one for each site. I would be developing a solution , where client wants to keep data in separate databases. Please advice if this is possible and how ?
This discussion was from a few years ago. Was a solution ever found for this?
What I want:
I want to be able to use one install on a subdomain like piwik.mydomain.com but be able to have multiple databases with different client and personal sites in each.
Why I want this:
I want to be able to log into PIWIK and just see sites of a certain type. I realize I could create different user login and then just give them access to these sites so they are the only ones that show up and that would be one organizational solution. But I also have this idea that multiple databases would provide some extra security and redundancy in case something happens to one database or one site explodes in traffic it doesn’t bring down everything. Keeping one code deployment instead of installing multiple code deployments would, as @halfdan mentioned, cut down on updating time.
My idea on a solution:
Let’s say I have the following three groupings of sites and I want to create three databases for each but use one code deployment. I would basically have to add a variable to the tracking code or some other unique identifier and then each time the tracking snippet is called it would catch this variables like “&sitegroup=2” and choose the right database for this sitegroup. Alternatively, you could create special subdomains for each subgrouping like personalsites.piwik.mydomain.com and clientsites1.piwik.mydomain.com and then write some code that would look for these urls and assign the proper database depending on the server request URL in the tracking code. RIght? I just tested the creation of these subdomains and then updating my tracking code with the subdomains and it looks like visits are still being counted so as long as I could write the code to detect the request server and direct each request to the proper database based on the domain then this could work … I guess I worry about whether this would cause significant performance issues though. Or whether it’s possible at all.
I’m looking for information about this subject and it seems like nothing was implemented…
@bfranklin@ravisingh, did you create some solution? Were you able to sort something out?
Our Matomo installation has a lot of websites and at least 10 of them have a big amount of monthly traffic. We are looking for the way to, using the same code base, have several databases, separated by groups, for example, as @bfranklin commented. This way we can avoid overloading the database that currently supports all sites.