Multi-master mode confusion for new comer

95 views
Skip to first unread message

Li Junhong

unread,
Nov 13, 2015, 11:49:54 PM11/13/15
to codership
Hi All,

I'm new to galera these days. I setup my 3 nodes galera cluster by setting the my.cnf like this in those 3 nodes:

wsrep_cluster_name=MyCluster
wsrep_cluster_address="gcomm://192.168.1.80,192.168.1.85,192.168.1.86"      # set this all all 3 nodes
wsrep_node_name=galera.node1
wsrep_node_address="192.168.1.80"     # this is for the 1st node, "192.168.1.85" for the 2nd node, and "192.168.1.86" for the 3rd node

Then started up the first node by "service mysql bootstrap", and joined 2nd/3rd node by "service mysql start"

Now the cluster is working fine. When I check the "show status like 'wsrep%';" in mysql, it showed that "wsrep_cluster_status=Primary" in all 3 nodes, which confused me a bit.

| wsrep_cluster_size           | 3                                                     |
| wsrep_cluster_state_uuid     | c563be0f-89df-11e5-9b69-46f65bd61f3e                  |
| wsrep_cluster_status         | Primary                                               |
| wsrep_ready                  | ON                                                    |


My questions are:
1) Is this (all 3 nodes showing wsrep_cluster_status=Primary) what we call multi-master mode of galera? Is there a master/slave mode, if yes, how to set up this mode instead of multi-master? What's the difference between them?
2) In my current cluster, if I shutdown the 1st started node, I assume it is the real master(which is started by "service mysql bootstrap"), what happens to the left two nodes? Is the master role transferred to one of the left 2 nodes in this case? I find that when I want to bring the 1st node back to the cluster, I just needed to run "service mysql start" instead of "service mysql bootstrap", is that a correct process?
3) I am planning to manage the galera cluster with pacemaker+corosync with pcs command, is there galera pacemaker agent recommended for multi-master mode? I found one in https://github.com/ClusterLabs/resource-agents.git , but it seems for master/slave mode, actually, that leads to my above confusions subsequently.

I googled a lot about my above questions, didn't get clear answers, which I wish to get here. Thank you guys.

Daniel Black

unread,
Nov 14, 2015, 1:29:30 AM11/14/15
to Li Junhong, codership-team


----- On 14 Nov, 2015, at 2:24 PM, Li Junhong lijh...@gmail.com wrote:

> Hi All,
>
> I'm new to galera these days. I setup my 3 nodes galera cluster by setting
> the my.cnf like this in those 3 nodes:
>
> wsrep_cluster_name=MyCluster
> wsrep_cluster_address="gcomm://192.168.1.80,192.168.1.85,192.168.1.86"
> # set this all all 3 nodes
> wsrep_node_name=galera.node1
> wsrep_node_address="192.168.1.80" # this is for the 1st node,
> "192.168.1.85" for the 2nd node, and "192.168.1.86" for the 3rd node
>
> Then started up the first node by "service mysql bootstrap", and joined
> 2nd/3rd node by "service mysql start"
>
> Now the cluster is working fine. When I check the "show status like
> 'wsrep%';" in mysql, it showed that "wsrep_cluster_status=Primary" in all 3
> nodes, which confused me a bit.
>
>| wsrep_cluster_size | 3
> |
>| wsrep_cluster_state_uuid | c563be0f-89df-11e5-9b69-46f65bd61f3e
> |
>| wsrep_cluster_status | Primary
> |
>| wsrep_ready | ON
> |
>
>
> My questions are:
> 1) Is this (all 3 nodes showing wsrep_cluster_status=Primary)

Look up what primary actually mean:
http://galeracluster.com/documentation-webpages/index.html

> what we call > multi-master mode of galera?

stop making assumptions.

There is no multi-master mode of galera. Galera doesn't care which node you write too.

> 2) In my current cluster, if I shutdown the 1st started node, I assume it
> is the real master(which is started by "service mysql bootstrap"), what
> happens to the left two nodes? Is the master role transferred to one of the
> left 2 nodes in this case?

try and see.

> I find that when I want to bring the 1st node
> back to the cluster, I just needed to run "service mysql start" instead of
> "service mysql bootstrap", is that a correct process?

yes. See documentation as to what bootstrap actually means.

> 3) I am planning to manage the galera cluster with pacemaker+corosync with
> pcs command, is there galera pacemaker agent recommended for multi-master
> mode? I found one in https://github.com/ClusterLabs/resource-agents.git ,
> but it seems for master/slave mode, actually, that leads to my above
> confusions subsequently.

read about the agent:

https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/galera#L32

Colocate the appropriate resources (IP/LB config etc.) related to what pacemaker considers the master node(s) and use those to write to those nodes.

> I googled a lot about my above questions, didn't get clear answers, which I
> wish to get here. Thank you guys.

Googling just wastes your time. Find the official docs, read them, think and then apply and validate.


--
--
Daniel Black, Engineer @ Open Query (http://openquery.com.au)
Remote expertise & maintenance for MySQL/MariaDB server environments.
Reply all
Reply to author
Forward
0 new messages