> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/galera-cluster/galera-management/configuration/configuring-mariadb-galera-cluster.md).

# Configuring MariaDB Galera Cluster

A number of options must be set for Galera Cluster to work with MariaDB. These should be set in the [MariaDB option file](/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files.md).

## Mandatory Options

Several options are mandatory, meaning they *must* be set for Galera Cluster to be enabled or to work properly. The mandatory options are:

* [wsrep\_provider](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_provider) — Path to the Galera library
* [wsrep\_cluster\_address](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_cluster_address) — See [Galera Cluster address format and usage](/docs/galera-cluster/galera-management/configuration/galera-cluster-address.md)
* [binlog\_format=ROW](/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables.md#binlog_format) — See [Binary Log Formats](/docs/server/server-management/server-monitoring-logs/binary-log/binary-log-formats.md)
* [wsrep\_on=ON](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_on) — Enable wsrep replication
* [default\_storage\_engine=InnoDB](/docs/server/server-management/variables-and-modes/server-system-variables.md#default_storage_engine) — This is the default value, or alternately [wsrep\_replicate\_myisam=1](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_replicate_myisam) (before MariaDB 10.6) or [wsrep\_mode=REPLICATE\_ARIA,REPLICATE\_MYISAM](https://mariadb.com/docs/galera-cluster/galera-management/configuration/pages/DCsAx83pKoXTCJ7t5Gwm#wsrep_mode=REPLICATE_ARIA,REPLICATE_MYISAM) (MariaDB 10.6 and later).
  * [innodb\_doublewrite=1](/docs/server/server-usage/storage-engines/innodb/innodb-system-variables.md#innodb_doublewrite) — This is the default value, and should not be changed.

## Performance-related Options

These are optional optimizations that can be made to improve performance.

* [innodb\_flush\_log\_at\_trx\_commit=0](/docs/server/server-usage/storage-engines/innodb/innodb-system-variables.md#innodb_flush_log_at_trx_commit) or [innodb\_flush\_log\_at\_trx\_commit=2](/docs/server/server-usage/storage-engines/innodb/innodb-system-variables.md#innodb_flush_log_at_trx_commit) — These settings can result in significantly better write performance by relaxing InnoDB's ACID durability. However, using these values introduces a risk of losing acknowledged transactions during simultaneous power failures, orchestrated server terminations, or a replicated trigger of a crashing bug across the cluster. For maximum durability, the default value of 1 is recommended.
* [innodb\_autoinc\_lock\_mode=2](/docs/server/server-usage/storage-engines/innodb/innodb-system-variables.md#innodb_autoinc_lock_mode) — This tells InnoDB to use interleaved method. Interleaved is the fastest and most scalable lock mode, and should be used when BINLOG\_FORMAT is set to ROW.

  Setting the auto-increment lock mode for InnoDB to interleaved, you’re allowing slaves threads to operate in parallel.
* [wsrep\_slave\_threads=4](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_slave_threads) — This makes state transfers quicker for new nodes. You should start with four slave threads per CPU core.

  The logic here is that, in a balanced system, four slave threads can typically saturate a CPU core. However, I/O performance can increase this figure several times over. For example, a single-core ThinkPad R51 with a 4200 RPM drive can use thirty-two slave threads. The value should not be set higher than [wsrep\_cert\_deps\_distance](/docs/galera-cluster/reference/galera-cluster-status-variables.md#wsrep_cert_deps_distance).

## Writing Replicated Write Sets to the Binary Log

Like with [MariaDB replication](/docs/server/ha-and-performance/standard-replication.md), write sets that are received by a node with [Galera Cluster's certification-based replication](/docs/galera-cluster/readme/about-galera-replication.md) are not written to the [binary log](/docs/server/server-management/server-monitoring-logs/binary-log.md) by default. If you would like a node to write its replicated write sets to the [binary log](/docs/server/server-management/server-monitoring-logs/binary-log.md), then you will have to set [log\_slave\_updates=ON](/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables.md). This is especially helpful if the node is a replication master. See [Using MariaDB Replication with MariaDB Galera Cluster: Configuring a Cluster Node as a Replication Master](/docs/galera-cluster/high-availability/using-mariadb-replication-with-mariadb-galera-cluster/using-mariadb-replication-with-mariadb-galera-cluster-using-mariadb-replica.md).

## Replication Filters

Like with [MariaDB replication](/docs/server/ha-and-performance/standard-replication.md), [replication filters](/docs/server/ha-and-performance/standard-replication/replication-filters.md) can be used to filter write sets from being replicated by [Galera Cluster's certification-based replication](/docs/galera-cluster/readme/about-galera-replication.md). However, they should be used with caution because they may not work as you'd expect.

The following replication filters are honored for [InnoDB](/docs/server/server-usage/storage-engines/innodb.md) DML, but not DDL:

* [binlog\_do\_db](/docs/server/ha-and-performance/standard-replication/replication-filters.md#binlog_do_db)
* [binlog\_ignore\_db](/docs/server/ha-and-performance/standard-replication/replication-filters.md#binlog_ignore_db)
* [replicate\_wild\_do\_table](/docs/server/ha-and-performance/standard-replication/replication-filters.md#replicate_wild_do_table)
* [replicate\_wild\_ignore\_table](/docs/server/ha-and-performance/standard-replication/replication-filters.md#replicate_wild_ignore_table)

The following replication filters are honored for DML and DDL for tables that use both the [InnoDB](/docs/server/server-usage/storage-engines/innodb.md) and [MyISAM](/docs/server/server-usage/storage-engines/myisam-storage-engine.md) storage engines:

* [replicate\_do\_table](/docs/server/ha-and-performance/standard-replication/replication-filters.md#replicate_do_table)
* [replicate\_ignore\_table](/docs/server/ha-and-performance/standard-replication/replication-filters.md#replicate_ignore_table)

However, it should be kept in mind that if replication filters cause inconsistencies that lead to replication errors, then nodes may abort.

See also [MDEV-421](https://jira.mariadb.org/browse/MDEV-421) and [MDEV-6229](https://jira.mariadb.org/browse/MDEV-6229).

## Network Ports

Galera Cluster needs access to the following ports:

* Standard MariaDB Port (default: 3306) - For MySQL client connections and [State Snapshot Transfers](/docs/galera-cluster/high-availability/state-snapshot-transfers-ssts-in-galera-cluster/introduction-to-state-snapshot-transfers-ssts.md) that use the `mysqldump` method. This can be changed by setting [port](/docs/server/server-management/variables-and-modes/server-system-variables.md#port).
* Galera Replication Port (default: 4567) - For Galera Cluster replication traffic, multicast replication uses both UDP transport and TCP on this port. Can be changed by setting [wsrep\_node\_address](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_node_address).
* Galera Replication Listening Interface (default: `0.0.0.0:4567`) needs to be set using [gmcast.listen\_addr](/docs/galera-cluster/reference/wsrep-variable-details/wsrep_provider_options.md#gmcastlisten_addr), either
  * in [wsrep\_provider\_options](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_provider_options): `wsrep_provider_options='gmcast.listen_addr=tcp://<IP_ADDR>:<PORT>;'`
  * or in [wsrep\_cluster\_address](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_cluster_address)
* IST Port (default: 4568) - For Incremental State Transfers. Can be changed by setting ist.recv\_addr in [wsrep\_provider\_options](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_provider_options).
* SST Port (default: 4444) - For all [State Snapshot Transfer](/docs/galera-cluster/high-availability/state-snapshot-transfers-ssts-in-galera-cluster/introduction-to-state-snapshot-transfers-ssts.md) methods other than `mysqldump`. Can be changed by setting [wsrep\_sst\_receive\_address](/docs/galera-cluster/reference/galera-cluster-system-variables.md#wsrep_sst_receive_address).

## Multiple Galera Cluster Instances on One Server

If you want to run multiple Galera Cluster instances on one server, then you can do so by starting each instance with [mysqld\_multi](/docs/server/clients-and-utilities/legacy-clients-and-utilities/mysqld_multi.md), or if you are using [systemd](/docs/server/server-management/starting-and-stopping-mariadb/systemd.md), then you can use the relevant [systemd method for interacting with multiple MariaDB instances](/docs/server/server-management/starting-and-stopping-mariadb/systemd.md#interacting-with-the-mariadb-server-process).

You need to ensure that each instance is configured with a different [datadir](/docs/server/server-management/variables-and-modes/server-system-variables.md#datadir).

You also need to ensure that each instance is configured with different [network ports](#network-ports).

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
