Skip to content

Instantly share code, notes, and snippets.

@sjwu
Created November 23, 2012 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjwu/4133784 to your computer and use it in GitHub Desktop.
Save sjwu/4133784 to your computer and use it in GitHub Desktop.
my.cnf for galera
[mysqld]
### mysql general option
bind-address = 0.0.0.0
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
### mysql optimization
# mandatory settings for galera
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
# query cache is not supported with wsrep
query_cache_size=0
query_cache_type=0
# synchronous replication allows for some optimizations (this is not required):
innodb_flush_log_at_trx_commit=0 # or 2
innodb_doublewrite=0
#sync_binlog=0
#innodb_flush_log_at_trx_commit=0
max_connections=1024
innodb_buffer_pool_size=400M
innodb_log_file_size=64M
key_buffer_size = 256M
max_allowed_packet = 32M
table_open_cache = 256
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 4
#log_slave_updates
### galera settings
default_storage_engine=InnoDB
binlog_format=ROW
log_bin=mysql-bin
wsrep_cluster_name=libreit
wsrep_cluster_address=gcomm://
wsrep_node_name=NAME
wsrep_sst_method=xtrabackup
wsrep_sst_auth=root:PASSWORD
wsrep_provider=/usr/lib/libgalera_smm.so
# how many threads to use for applying slave writsets - cpu core * 2
wsrep_slave_threads=4
# change auto_increment_increment and auto_increment_offset automatically
wsrep_auto_increment_control=1
# enable "strictly synchronous" semantics for read operations
wsrep_causal_reads=0
# retry autoinc insert, which failed for duplicate key error
wsrep_drupal_282555_workaround=1
# Command to call when node status or cluster membership changes.
# Will be passed all or some of the following options:
# --status - new status of this node
# --uuid - UUID of the cluster
# --primary - whether the component is primary or not ("yes"/"no")
# --members - comma-separated list of members
# --index - index of this node in the list
#wsrep_notify_cmd=
# how many times to retry deadlocked autocommits
wsrep_retry_autocommit=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment