Attach multiple DBs to PIWIK server


#1

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 ?

Kind Regards
Ravi Singh


(Fabian Becker) #2

This is currently not possible.


#3

Any guidelines following which I may achieve this.


#4

What about creating multiple installs.

(You may have to adjust some ports to not con_flict)

Create a new database per site, create a new folder per install

/piwik
/piwik2
/piwik3

Keeps each client data separate my only concern would be cpu usage of server running the multiple installs.

Maybe one of the admins could verify that possibility?


#5

Is there no approach in which I can add a layer to database calls to store and retrieve data from different databases ?


(Fabian Becker) #6

@lesjokolat: You’d have to update them all seperately, which ain’t very nice.

@ravisingh: Right now there isn’t sorry, but I think it is a reasonable feature request. Can you create a ticket at http://dev.piwik.org?


(BenFranklin!) #7

Hey @ravisingh and @halfdan:

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.

Any other ideas on this?

Thanks for any feedback.