Galera Mysql Cluster XA transactions alternative - mysql

On Galera Mysql Cluster (either Percona or MariaDB) limitation refers that XA transactions are not supported, cause of cluster nature, which is perfectly understand. My question: (i am not a developer so please show some mercy on me) is there any mechanism that replies an OK if the statement has been committed to majority of nodes - something like MongoDB write concern?

Galera replication is synchronous and when a write query gets back to you, the data is on every node in the cluster. If for any reason a node cannot apply the transaction, it will kill itself to maintain the integrity of data throughout the cluster.

Related

Current status of support for parallell migration on a MariaDB Galera cluster

The Flyway docs state that
Flyway uses the locking technology of your database to coordinate multiple nodes. This ensures that even if multiple instances of your application attempt to migrate the database at the same time, it still works. Cluster configurations are fully supported.
When migrating on a MariaDB Galera cluster on Flyway versions > 6 (and maybe earlier, haven't checked), MySQLConnection or MySQLNamedLockTemplate is used to coordinate locks between multiple nodes migrating simultaneously. MySQLConnection/MySQLNamedLockTemplate implement locking through get_lock()
However, get_lock() is not supported in Galera:
Unsupported explicit locking include [...] GET_LOCK(), [...]
And indeed, when migrating in parallel on 2 nodes on our Galera cluster we frequently see errors because both nodes try to migrate at the same time (even in grouped mode).
It looks like this was a known issue in 2018. What is the current status of the issue? Is there a plan for supporting parallel migration on Galera clusters in the Flyway project, or is there some external project that implements this?

Can I implement synchronous and asynchronous replication with the MySQL cluster?

I want to do synchronous and asynchronous replication, synchronize for some databases, and asynchrony for others.
Asynchronous I am doing it through MariaDB, through the traditional system that has replication.
But I want to implement synchronous replication also with Mysql / MariaDB.
The problem is that I do not know if Mysql Cluster also does that work, or if it is not necessary to have Mysql installed only or MariaDb and only use Mysql Cluster for both.
Thank you.
Disclosure: I am working for the MySQL Cluster team - "MySQL Cluster" as in NDB Cluster.
MySQL NDB Cluster always uses synchronous replication between its nodes. You can still use asynchronous replication to other MySQL instances or MySQL Clusters.
AFAIK only MySQL offers NDB and as open source.
Due to the usual network limitations synchronous replication is better suited for high availability in the local data center. It gives you an always consistent view of your data, two or more active instances and makes programing against it much easier.
Asynchronous is more for replication between data centers or availability zones where you can live with temporary inconsistencies in the data and have your programming model set up accordingly.
"MySQL Cluster" has more than one meaning, so I will avoid it.
"Galera" is the underlying cluster technology in MariaDB, PXC, and (if you do the installation yourself), MySQL.
Galera provides essentially-synchronous among (typically) 3 nodes. Meanwhile, each node can have any number of asynchronous Slaves hanging off it.
Also, one Galera cluster can asynchronously replicate to another such cluster. This is sometimes done with a cluster in each of two datacenters.
Mixing sync and async at the database level is quite unusual, and seems strange. The general principle of Replication is that all servers will have exactly the same (barring delays) data. Please elaborate on what you want to do. Also, think out of the box when it comes to topologies.

Multimaster replication with multiple slaves with MariaDB/Mysql

Is it possible to receive the following configuration with Maria DB/MySQL:
Two master nodes with synchronous replication (actually need one, second need for failover and could be asynchronous ),
N slaves nodes with asynchronous replication,
We want to use Amazon EC2 with autoscale.
What are the pitfalls?
Which better for this task: Mysql or MariaDB?
There is no "synchronous Multi-Master replication" in standard replication.
Sounds like you would benefit from MariaDB with Galera. With that, you not only get synchronous replication, but also automatic recovery from server failure.

MySQL Multi-master replication

We have some (10-) MySQL server nodes and we want them to be replicated in a way that if one goes down the rest never get affected.
I know MySQL provides Master/Slave (not good for us) and Multi-Master replication.
Does MySQL Multi-Master replication work like a mesh? I mean all nodes can get updated from all other nodes?
Is it true that even in Multi-Master replication (MySQL) each node can only get the data from one master???
So if the native MySQL replication features can not fulfill our requirement, do you know any tool that can do this? Our preference is the built-in MySql replication.
The answer to your problem is simple yet very technical aswell. Traditional MYSQL tools cannot help so you need help of Galera cache from codership. Some features are synchronous replication which MYSQL do not offer, and it works as a cluster if you have a galera MYSQL cluster setup, one goes down rest keeps on going.
I personally use Percona xtradb cluster for this, percona xtradb cluster is patched version of MYSQL and galera embeded together. All servers can take reads and writes.
I have written an article on installing this but cannot post here as stack overflow may consider as link building.
DO some research on Galera, as you use normal MYSQL in a cluster environemnt, FULL HA and HS.
If you need some more info feel free to discuss it with me.
Thanks...
I've been researching this as well. MySQL seems to offer multi-master replication. It's explained here: http://www.onlamp.com/pub/a/onlamp/2006/04/20/advanced-mysql-replication.html
and a more complex example with masters and slaves here: http://capttofu.livejournal.com/1752.html.
There are 3rd party tools as well and the one that seems to come up often is Tungsten: http://code.google.com/p/tungsten-replicator/
And here's an excellent article on multi-master replication with MySQL: http://scale-out-blog.blogspot.com/2012/04/if-you-must-deploy-multi-master.html

how does mysql cluster match up redis in speed?

mysql-cluster-expert-5.1 document mentioned that:
"MySQL Cluster tables in MySQL 5.1 are normally stored completely in memory rather than on disk (this is why we refer to MySQL cluster as an in-memory database)"
which means mysql cluster is a distributed memory database, so has anybody ever done a comparison of mysql cluster & redis on speed?
I don't think redis does anything remotely similar to MySQL cluster, so you can't compare them.
MySQL cluster is a high-availability, fuly durable SQL cluster with fully synchronous replication. Redis is not. As far as I understand, redis supports neither synchronous replication, nor SQL.
MySQL cluster means that when you can COMMIT TRANSACTION**, if you lose any cluster member permanently 1ms later, your data are still safe. MySQL cluster query nodes (which are the clients) automatically fail-over in a very short time (typically < 5 seconds).
Redis does absolutely none of this. It is a non-SQL based data store which has master-slave replication (failover? You'd better implement it yourself)
You may as well ask if a motorbike is faster than an ocean liner.
** I don't think redis supports transactions, so that notion is rubbish as well.