-
Notifications
You must be signed in to change notification settings - Fork 15
/
bootstrap-mn.sh
executable file
·76 lines (65 loc) · 1.72 KB
/
bootstrap-mn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
echo "Starting Master Node Configuration"
echo "$@" > /tmp/mn_passed_args
/vagrant/bootstrap-nix.sh "$1" "$2" "$3"
## Copy over our Master App
cp -r /vagrant/configs/master/APL-masternode /opt/splunk/etc/apps
## Final Configuration Tasks
/vagrant/bootstrap-final.sh
### HAPROXY CONFIG
echo "Starting Haproxy Configuration"
if [ ! -f /etc/haproxy/haproxy.cfg ]; then
# Install haproxy
sudo yum install haproxy -y
# Configure haproxy
cat > /etc/default/haproxy <<EOD
# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1
# Add extra flags here.
#EXTRAOPTS="-de -m 16"
EOD
cat > /etc/haproxy/haproxy.cfg <<EOD
global
daemon
maxconn 256
log 127.0.0.1 local2
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
default_backend webservers
backend webservers
balance roundrobin
# Poor-man's sticky
# balance source
# JSP SessionID Sticky
# appsession JSESSIONID len 52 timeout 3h
option httpchk
option forwardfor
option http-server-close
server shc1 10.10.50.140:8000 maxconn 32 check ssl verify none
server shc2 10.10.50.150:8000 maxconn 32 check ssl verify none
server shc3 10.10.50.160:8000 maxconn 32 check ssl verify none
listen admin
bind *:8080
stats enable
EOD
cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.orig
/bin/systemctl restart haproxy.service
fi
### Logging
if [ ! -f /etc/rsyslog.d/haproxy.conf ]; then
cat > /etc/rsyslog.d/haproxy.conf <<EOD
local2.* /var/log/haproxy.log
EOD
cat >> /etc/rsyslog.conf <<EOD
$ModLoad imudp
$UDPServerRun 514
$UDPServerAddress 127.0.0.1
EOD
service rsyslog restart
service haproxy restart
fi