Skip to content

Instantly share code, notes, and snippets.

@mikehale
Created March 19, 2009 14:40
Show Gist options
  • Select an option

  • Save mikehale/81844 to your computer and use it in GitHub Desktop.

Select an option

Save mikehale/81844 to your computer and use it in GitHub Desktop.
shared ip addresses between 2 routers
vrrp_instance loadbalancer1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type AH
auth_pass k@l!ve1
}
virtual_ipaddress {
172.16.209.200/24 dev eth0
}
}
vrrp_instance loadbalancer2 {
state BACKUP
interface eth0
virtual_router_id 52
priority 100
advert_int 1
authentication {
auth_type AH
auth_pass k@l!ve3
}
virtual_ipaddress {
172.16.209.201/24 dev eth0
}
}
# MASTER
virtual_server 172.16.209.200 3306 {
delay_loop 6
lb_algo wlc
lb_kind NAT
nat_mask 255.255.255.0
protocol TCP
real_server 127.0.0.1 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
real_server 172.16.209.129 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
}
# BACKUP
virtual_server 172.16.209.201 3306 {
delay_loop 6
lb_algo wlc
lb_kind NAT
nat_mask 255.255.255.0
protocol TCP
real_server 127.0.0.1 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
real_server 172.16.209.129 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
}
vrrp_instance loadbalancer1 {
state BACKUP
interface eth1
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type AH
auth_pass k@l!ve1
}
virtual_ipaddress {
172.16.209.200/24 dev eth1
}
}
vrrp_instance loadbalancer2 {
state MASTER
interface eth1
virtual_router_id 52
priority 150
advert_int 1
authentication {
auth_type AH
auth_pass k@l!ve3
}
virtual_ipaddress {
172.16.209.201/24 dev eth1
}
}
# BACKUP
virtual_server 172.16.209.200 3306 {
delay_loop 6
lb_algo wlc
lb_kind NAT
nat_mask 255.255.255.0
protocol TCP
real_server 127.0.0.1 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
real_server 172.16.209.131 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
}
# MASTER
virtual_server 172.16.209.201 3306 {
delay_loop 6
lb_algo wlc
lb_kind NAT
nat_mask 255.255.255.0
protocol TCP
real_server 127.0.0.1 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
real_server 172.16.209.131 3306 {
TCP_CHECK {
connect_port 3306
connect_timeout 5
}
}
}
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
ndbcluster
default-storage-engine=NDBCLUSTER
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
language = /usr/share/mysql/english
skip-external-locking
bind-address = 0.0.0.0
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 8
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
skip-bdb
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
[mysql_cluster]
#ip of management server(s)
ndb-connectstring=172.16.209.130
!includedir /etc/mysql/conf.d/
[ndb_mgmd default]
Datadir=/var/lib/mysql-cluster
LogDestination=SYSLOG:facility=syslog
[ndb_mgmd]
HostName=172.16.209.130
Id=1
# [ndb_mgmd]
# HostName=172.16.209.131
# Id=2
[ndbd default]
DataDir=/var/lib/mysql-cluster
BackupDataDir=/var/lib/mysql-cluster/backup
NoOfReplicas=2
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
StopOnError=false
StartPartialTimeout=5
StartPartitionedTimeout=5
[ndbd]
HostName=172.16.209.131
[ndbd]
HostName=172.16.209.129
[mysqld]
[mysqld]
task :default => [:update_servers]
desc "Update servers with current config"
task :update_servers do
puts `scp lb1_keepalived.conf root@vm-ubuntu-1:/etc/keepalived/keepalived.conf`
puts `scp my.cnf root@vm-ubuntu-1:/etc/mysql/`
puts `scp ndb_mgmd.cnf root@vm-ubuntu-1:/etc/mysql/`
puts `scp lb2_keepalived.conf root@vm-ubuntu-2:/etc/keepalived/keepalived.conf`
puts `scp my.cnf root@vm-ubuntu-2:/etc/mysql/`
puts `scp ndb_mgmd.cnf root@vm-ubuntu-2:/etc/mysql/`
puts `scp my.cnf root@vm-ubuntu-3:/etc/mysql/`
puts `scp ndb_mgmd.cnf root@vm-ubuntu-3:/etc/mysql/`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment