Sample HAproxy configuration

From VoIPmonitor.org
Jump to navigation Jump to search

Following Configuration was taken from host with IPs 10.1.2.87, 192.168.30.7:

haproxy.conf

[root@localhost ~]# cat /etc/haproxy/haproxy.cfg

global
        daemon
        maxconn 4096
defaults
        timeout connect 10s
        timeout client  10s
        timeout server  10s
        option tcplog
        option tcpka 

# Handle Incoming TCP Connection request for HAproxy
frontend frontend1
    mode tcp
    option tcpka
    bind 10.1.2.87:6033
    default_backend galera_cluster 

backend galera_cluster
    #balance roundrobin
    server Node1 127.0.0.1:3306 check
    server Node2 10.1.2.72:3306 check backup
    server Node3 10.1.2.75:3306 check backup

galera.cnf

[root@localhost ~]# cat /etc/my.cnf.d/galera.cnf

[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0

# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so 

# Galera Cluster Configuration
wsrep_cluster_name="VoIPmon_DB_cluster"
wsrep_cluster_address="gcomm://192.168.30.5,192.168.30.6,192.168.30.7" 

# Galera Synchronization Configuration
wsrep_sst_method=rsync 

# Galera Node Configuration
wsrep_node_address="192.168.30.7"
wsrep_node_name="DB_Node3"

my.cnf

[root@localhost ~]# cat /etc/my.cnf.d/server.cnf

[server]
[mysqld]
innodb_compression_algorithm=lz4
default-authentication-plugin=mysql_native_password
skip-log-bin
symbolic-links=0
innodb_flush_log_at_trx_commit=0
innodb_flush_log_at_timeout = 1800
max_heap_table_size = 24G
innodb_log_file_size = 2G
innodb_log_buffer_size = 2G
innodb_buffer_pool_dump_pct=0
innodb_file_per_table = 1
open_files_limit = 200000
skip-external-locking
key_buffer_size = 2G
sort_buffer_size = 65M
max_connections = 100000
max_connect_errors = 1000
skip-name-resolve
max_allowed_packet=256M
wsrep_slave_threads=46
innodb_read_io_threads = 20
innodb_write_io_threads = 20
innodb_purge_threads = 20
innodb_flush_neighbors = 0
innodb_io_capacity = 100000
innodb_io_capacity_max = 1000000
innodb_doublewrite = 0
innodb_buffer_pool_size = 170G
innodb_flush_method = O_DIRECT
transaction-isolation = READ-UNCOMMITTED
performance_schema=0