MariaDB 10
blog.mariadb.org
blog.mariadb.org
I, however, am a postgres guy now. Our last MySQL project was retired a few months ago.
Postgres is still my preference for a RDBMS. Schemas, Triggers, JSON, Geo, PL, robust data types, it just offers so much more then MySQL/innoDB/MyISAM.
You can give each tenant his own schema, that way you can even make some nice split-testing when you incorporate new features in your app requiring changes in you database. Once a fraction of your tenants have tested/approved (much better if they choose themself to take part of a beta) the new model, you are good for rolling out progressively a full implementation to all of your tenants.
Anyway, if you ever end up with something elegant on this, I would be truly interested in reading about it. It's a good example of how a DBA concept can help app dev teams, who, in alarming numbers, prioritize an RDBMS' ease of use over its power.
Each tenant is assigned a subdomain (No vhost, all routed by the app to the same codebase) with the name he choosed when he subscribed. So this name is retrieved by inspecting the host header the browser send while connecting to the webapp, this name is checked in the public schema to find an appropriate uuid assigned (if it exists of course).
Something like :
App_DB (database)
-- public (public schema)
-- tenants (tenants table)
-- tenant_uuid uuid
-- tenant_name text (same as subdomain name)
-- coderev numeric (for split testing)
-- some tenant general info like creation date, choosen plan, ...
-- some other tables accessible by all tenants like shared stats, queues, etc ...
I then use this tenant_uuid as the schema name for this tenant : -- "b6e42fd1-d5b9-4de4-ba6b-6eca1dae06ff" (tenant_uuid schema name)
-- users (it's a multi-user webapp per tenants, so ...)
-- email (for auth)
-- password (bcrypt for auth)
-- etc ...
-- other tables needed for the webapp
This for each tenant, so some tenants can have a different schema stucture based on their public.coderevWhen the user login, his credentials are checked in his tenant schema, the tenant name and uuid are set in his session for not messing with other tenants data.
I think there are 2 ways to deal with connection pooling (If we are both talking about PgBouncer || pgpool connection pooling to be sure).
- The first one is to create a new PostgreSQL user for each tenant in order to access only his schema. Then there is no need to set the schema search path prior the connection object as by definition his search_path will be set to $user,public (http://www.postgresql.org/docs/9.1/static/ddl-schemas.html) But then, I can't really see the point of a connection pooling. I don't really like this solution, so many users, roles, passwords ... - The second (which I choose) is to connect with a role having access to all the schemas. You can set this one for connection pooling. The search_path is only set to public, and the queries use the qualified name to access the tenant data, ie: SELECT * FROM "b6e42fd1-d5b9-4de4-ba6b-6eca1dae06ff".users You can use the connections readily made available by the connection pool and query the data for the tenant you need without touching the search_path. The security is now dealt with the application and not the DB.
For the multi-version domain model, the coderev set in the public.tenants schema is retrieved with the tenant_uuid associated with the tenant name and then used by the webapp controller to route to the associated code version. No need for a second server, just a different branch on the same server. Transitioning a user then just really mean updating his schema and routing it through the new codebase. And that's why I said it's very ugly, because I still need to implement a good DDL and DML stategy in order to navigate between different versions without losing data.
Like you said, it's a tough environment. Unfortunately, I have nothing elegant to propose but I'm also interested in reading how others deal with that kind of stuff. I still lack fluency to write a blog post or something like that which could encourage debating or discussions. I'd be very glad if yourself find some interesting stuff on this topic to share it with me, my email address is my hn username @ gmail.com
Say you want to upgrade a stored function in your database. You need to make sure that both the new and the old version of the function are available until all application code that uses the stored procedure has been updated.
Without schemas, you'd have to add a version identifier to each function, like get_customer_5(), get_customer_6() etc.
With schemas, you can just put different versions of the functions into different schemas, and just change the search_path in your application code to use functions from the new schema. When all application code has been updated, you can drop the old schema.
With MySQL, you can choose 2 way to architecture your data : - the fully isolated way : each tenant has his own database. - the shared way : all tenants share the same schema, you usually use a tenant_id column on tables to query your data adequately.
Some other RDBMS like PostgreSQL offer you a third way between the fully isolated a shared data system : - all tenant access the same database but their data are stored on their own schema. It's up to you to decide if the tenants access their schema with the same database role (kind of user) or if you create a role for accessing solely their own schema.
Example :
App_DB
-- Public schema
-- tenant_id uuid
-- tenant_name (subdomain name for example)
-- etc ...
-- tenant (named after the public.tenant_id)
-- your application tables
-- tenant (named after the public.tenant_id)
-- your application tables
-- tenant (named after the public.tenant_id)
-- Some beta tables model for version n+1 of your app or whatever, you can add more table columns for this very tenant if he needs special features for example.
I hope it's non-documentation language but still english language :) (Need to improve my english and my writing skills)MariaDB is essentially a drop in replacement; its also faster than MySQL:
https://mariadb.com/kb/en/moving-from-mysql/
https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/
"For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version (for example MySQL 5.1 -> MariaDB 5.1, MariaDB 5.2 & MariaDB 5.3 are compatible. MySQL 5.5 will be compatible with MariaDB 5.5)."
"This means that for most cases, you can just uninstall MySQL and install MariaDB and you are good to go. (No need to convert any datafiles if you use same main version, like 5.1). You must however still run mysql_upgrade to finish the upgrade. This is needed to ensure that your mysql privilege and event tables are updated with the new fields MariaDB uses."
"With this release, MariaDB 10.0 is now the current stable version of MariaDB. It is an evolution of the MariaDB 5.5 series with several entirely new features not found anywhere else and with backported and reimplemented features from MySQL 5.6."
I want to say yes, but as always, TEST FIRST.
I have heard this is not true for high core count scale up type systems. Has anyone here done that kind of testing?
This simple command replaces mysql in one shot? I might test it tonight if so. Do I have to run mysql_upgrade?
Got a good recommendation for a guide?
https://downloads.mariadb.org/mariadb/repositories/#mirror=o...
Just pick your distro and you're good to go. I didn't have to run anything else.
# cat /etc/apt/preferences
Package: *
Pin: origin repo.percona.com
Pin-Priority: 1003
Package: *
Pin: origin ftp.osuosl.org
Pin-Priority: 1002
# tail /etc/apt/sources.list
deb ftp://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main
deb-src ftp://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise mainWe may have too much clueless developer in the wild, imitating for security.
Like the more linux is spreading, the more the sect of the post devil spread, you recognize them with their dark incatation: chmod 777 (the number of the post devil) and chown root:root.
- pgsql supports synchronous master-slave replication natively, with excellent performance
- mysql supposedly does multi-master replication, but does not solve the hard problems. You can't write on the same row on two masters simultaneously or replication stops; sequential ids are not synchronized between masters; you can't get serial transaction isolation between masters.
All in all, I'd rate replication support between both databases as nearly identical. Pgsql does master-slave better, mysql has a half-hearted attempt at multi master. Given that on all else pgsql is markedly better, I can't see replication as the reason for picking mysql.
That is not the case here. Did you read the site?
http://www.percona.com/resources/technical-presentations/mee...
Given the common ancestry, your easiest transition would be to SQL Server. But if your reasons are to get out from under from vendor control, that isn't really achieving anything.
We chose to keep that ability to migrate off. In hindsight it was a little more thought up front but little to no additional overhead now.
AWS provides a ton of open source compliant services. When you decide to use a proprietary one just build in the appropriate abstractions.
My guess is there isn't an enforced MySQL version across all of Google.
"We asked Google for more information, and the company sent us a statement which said: "Google's MySQL team is in the process of moving internal users of MySQL at Google from MySQL 5.1 to MariaDB 10.0. Google's MySQL team and the SkySQL MariaDB team are looking forward to working together to advance the reliability and feature set of MariaDB."
"Q: Why didn't you base this on MariaDB, Percona Server, Drizzle, etc....
A: We reached a consensus that MySQL-5.6 was the right choice for this, as it has the production-ready features we need to operate at scale, and the features planned for MySQL-5.7 seem like a fitting path forward for us. We will continue to revisit this decision as the ecosystem evolves."
MariaDB 10 just hit after the launch, much less conception, of Webscale, and still doesn't have all of the features from MySQL 5.6 in it.
Far from being a Victorian-era name, it was most popular in the 1960's, and remains more popular today than it was during the Victorian era[2].
However, it was a popular name in literature during the Victorian era[3], with mentions hitting a peak in 1908 (technically that was the Edwardian era, but close enough). Depending on your smoothness settings, it does appear that Maria was actually more commonly mentioned in 1999 than in 1908, though.
Interestingly, there is a dramatic dip in mentions during the 1920s. I don't have a good theory as to why this was.
[1] http://www.ssa.gov/cgi-bin/namesbystate.cgi
[2] http://www.babynamewizard.com/baby-name/girl/maria
[3] https://books.google.com/ngrams/graph?content=Maria&year_sta...