Skip to content

Commit

Permalink
edit config for haproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
GeunSam2 committed Sep 3, 2020
1 parent a49db9f commit 25dd9f8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 69 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
SERVICE_N := sampledb
TAG := v1
IMAGE_NAME_BASE := geunsam2/mha-$(SERVICE_N)
MYSQL_PASS := admin123!@#

.PHONY: help build push clean

Expand Down
35 changes: 0 additions & 35 deletions Makefile.back

This file was deleted.

20 changes: 9 additions & 11 deletions conf/sampledb/haproxy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "%your_service_id%,",
"id": "%your_service_id%",
"backoffFactor": 1.15,
"backoffSeconds": 1,
"constraints": [
Expand All @@ -8,18 +8,16 @@
"container": {
"portMappings": [
{
"containerPort": 33406,
"hostPort": %replace_here%,
"containerPort": %port_for_master_group%,
"hostPort": %port_for_master_group%,
"protocol": "tcp",
"servicePort": %replace_here%,
"name": "%replace_here%"
"name": "master_group"
},
{
"containerPort": 33408,
"hostPort": %replace_here%,
"containerPort": %port_for_slave_group%,
"hostPort": %port_for_slave_group%,
"protocol": "tcp",
"servicePort": %replace_here%,
"name": "%replace_here%"
"name": "slave_group"
}
],
"type": "DOCKER",
Expand All @@ -31,11 +29,11 @@
"parameters": []
}
},
"cpus": 0.5,
"cpus": %cpu_limit%,
"disk": 0,
"instances": 1,
"maxLaunchDelaySeconds": 300,
"mem": 512,
"mem": %mem_limit%,
"gpus": 0,
"networks": [
{
Expand Down
18 changes: 9 additions & 9 deletions conf/sampledb/haproxy1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ defaults
maxconn 10000
retries 3
frontend master
bind *:33406
default_backend master_13306
backend master_13306
bind *:%port_for_master_group%
default_backend master_back
backend master_back
mode tcp
balance roundrobin
server master1 128.11.1.69:13306 check
server master %master_1_ip%:%master_1_port% check
frontend slave
bind *:33408
default_backend slave_13308
backend slave_13308
bind *:%port_for_slave_group%
default_backend slave_back
backend slave_back
mode tcp
balance roundrobin
server slave1 128.11.1.68:13308 check
server slave2 128.11.1.69:13308 check backup
server slave1 %slave_1_ip%:%slave_1_port% check
server slave2 %slave_2_ip%:%slave_2_port% check
26 changes: 13 additions & 13 deletions conf/sampledb/haproxy2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ defaults
maxconn 10000
retries 3
frontend master
bind *:33406
default_backend master_13306
backend master_13306
mode tcp
balance roundrobin
server master1 128.11.1.68:13306 check
bind *:%port_for_master_group%
default_backend master_back
backend master_back
mode tcp
balance roundrobin
server master %master_2_ip%:%master_2_port% check
frontend slave
bind *:33408
default_backend slave_13308
backend slave_13308
mode tcp
balance roundrobin
server slave1 128.11.1.68:13308 check
server slave2 128.11.1.69:13308 check backup
bind *:%port_for_slave_group%
default_backend slave_back
backend slave_back
mode tcp
balance roundrobin
server slave1 %slave_1_ip%:%slave_1_port% check
server slave2 %slave_2_ip%:%slave_2_port% check

0 comments on commit 25dd9f8

Please sign in to comment.