3

we use percona cluster 5.7.20 my wsrep configuration.

max_connections = 10000
open_files_limit = 32768
wsrep_sync_wait=1
wsrep_causal_reads=ON
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
wsrep_provider_options="pc.ignore_quorum=true;pc.ignore_sb=true;gcache.size=2G; gcache.page_size=1G;gcs.fc_limit = 256; gcs.fc_factor = 0.99;"
wsrep_slave_threads=32
[sst]
inno-apply-opts="--use-memory=8G"
compressor="pigz"
decompressor="pigz -d"

i did a test for sync replication via php 7 test code. https://github.com/ureyni/percona_replicationtest

insert value to node1 with a transaction. after execute commit, do a select query with some value on node2 if data not found, query exec on node3.

the test was not successful.

why? I don't understand because all documents on the internet say it's synchronous.

please help.

ureyni
  • 71
  • 6

1 Answers1

2

I would first check that the nodes have actually formed a cluster.

Connect to any of the nodes and run the following query

show status like 'wsrep_%';

If all 3 nodes are connected, you should see something like the following

mysql> show status like 'wsrep%';
+----------------------------+--------------------------------------+
| Variable_name              | Value                                |
+----------------------------+--------------------------------------+
| wsrep_local_state_uuid     | b598af3e-ace3-11e2-0800-3e90eb9cd5d3 |
...
| wsrep_local_state          | 4                                    |
| wsrep_local_state_comment  | Synced                               |
...
| wsrep_cluster_size         | 3                                    |
| wsrep_cluster_status       | Primary                              |
| wsrep_connected            | ON                                   |
...
| wsrep_ready                | ON                                   |
+----------------------------+--------------------------------------+

If wsrep_ready is OFF, then the node has not initialized correctly. You can check the logs to see if an error has occurred.

If wsrep_cluster_size is 1, then a cluster has not been formed. The node is acting standalone. The first thing to check would be to see if the wsrep_cluster_address variable has been set correctly. This is from the docs

wsrep_cluster_address

Specify the IP addresses of nodes in your cluster. At least one is required for a node to join the cluster, but it is recommended to list addresses of all nodes. This way if the first node in the list is not available, the joining node can use other addresses.

For more information, it's best to look at

https://www.percona.com/doc/percona-xtradb-cluster/5.7/configure.html

  • Thanks for help, Cluster is working seem correctly , my problem is after commit on node1 , i did'nt take data from node2 or node3, if i do select stmt 5000 milisecond after insert stmt , i can take data from other nodes. but we use queue for our services , switching between services is very fast, sometimes one service insert data , second service on other server cant take data. – ureyni Feb 02 '18 at 08:35
  • 2
    I've used your code as a repro case, Thanks, it was a big help! This is a bug in 5.7.20 and a bug has been created to track the issue [link to the bug](https://jira.percona.com/browse/PXC-2061) – Kenn Takara Feb 21 '18 at 05:00
  • @KennTakara Thank you. I seem to have run into this bug as well, and if not for your report of it, I probably never would have found the cause. – Timo Sep 03 '18 at 14:50