Skip to content

Instantly share code, notes, and snippets.

@kbarber
Created December 4, 2011 21:16
Show Gist options
  • Save kbarber/1431306 to your computer and use it in GitHub Desktop.
Save kbarber/1431306 to your computer and use it in GitHub Desktop.
foreman replication
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
log-bin=mysql-bin
binlog-do-db=foreman_production
binlog-ignore-db=mysql
binlog-ignore-db=test
binlog-ignore-db=foreman_production.sessions # option if you want to avoid replicating session information
server-id=1 # should be 2 for the second host
default_character_set=utf8
log_slow_queries
default_storage_engine=innodb
innodb_file_per_table
relay-log=mysqld-relay-bin
report-host=foreman1.vm # should be foreman2.vm for the second host
innodb_flush_log_at_trx_commit=1
sync_binlog=1
# Fixes auto_increment allocation across 2 nodes
auto_increment_increment=2
auto_increment_offset=1 # should be 2 for node 2
master-host=foreman2.vm # should be foreman1.vm for the second host
master-port=3306
master-user=repl
master-password=slavepass
master-connect-retry=60
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment