Commit 3290fcc4 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Galera related config should happen elsewhere

parent c16a96ba
all: haproxy-cfg haproxy-config all: haproxy-cfg
tar xf haproxy-1.8.9.tar.gz tar xf haproxy-1.8.9.tar.gz
$(MAKE) -C haproxy-1.8.9 TARGET=linux2628 USE_PCRE=1 USE_PCRE_JIT=1 USE_OPENSSL=1 USE_ZLIB=1 USE_TFO=1 USE_SYSTEMD=1 $(MAKE) -C haproxy-1.8.9 TARGET=linux2628 USE_PCRE=1 USE_PCRE_JIT=1 USE_OPENSSL=1 USE_ZLIB=1 USE_TFO=1 USE_SYSTEMD=1
$(MAKE) -C haproxy-1.8.9 install PREFIX=/usr $(MAKE) -C haproxy-1.8.9 install PREFIX=/usr
...@@ -9,8 +9,6 @@ all: haproxy-cfg haproxy-config ...@@ -9,8 +9,6 @@ all: haproxy-cfg haproxy-config
mkdir -p /etc/haproxy mkdir -p /etc/haproxy
@echo "$$HAPROXY_CFG" > /etc/haproxy/haproxy.cfg @echo "$$HAPROXY_CFG" > /etc/haproxy/haproxy.cfg
@echo "$$HAPROXY_CFG" > /etc/haproxy/haproxy.cfg.template @echo "$$HAPROXY_CFG" > /etc/haproxy/haproxy.cfg.template
@echo "$$HAPROXY_CONFIG" > /etc/config/haproxy
install -v -Dm755 haproxy /usr/share/easycwmp/functions
install -v -Dm755 haproxy_discovery.sh /usr/bin install -v -Dm755 haproxy_discovery.sh /usr/bin
install -v -Dm755 haproxy_stats.sh /usr/bin install -v -Dm755 haproxy_stats.sh /usr/bin
sed -e '/^UserParameter=device\.product.*/a UserParameter=haproxy.stats[*],/usr/bin/haproxy_stats.sh $$1 $$2 $$3 $$4' -i /etc/zabbix_agentd.conf sed -e '/^UserParameter=device\.product.*/a UserParameter=haproxy.stats[*],/usr/bin/haproxy_stats.sh $$1 $$2 $$3 $$4' -i /etc/zabbix_agentd.conf
...@@ -22,24 +20,5 @@ define HAPROXY_CFG ...@@ -22,24 +20,5 @@ define HAPROXY_CFG
global global
log /dev/log local0 info log /dev/log local0 info
stats socket /run/haproxy/info.sock mode 666 expose-fd listeners level user stats socket /run/haproxy/info.sock mode 666 expose-fd listeners level user
listen MariaDB
bind *:3306
mode tcp
log global
timeout connect 10s
timeout client 10800s
timeout server 10800s
balance source
option httpchk
default-server port 9000 inter 2s downinter 5s rise 3 fall 2 slowstart 60s maxconn 150 maxqueue 1 weight 100
endef endef
export HAPROXY_CFG export HAPROXY_CFG
haproxy-config:
define HAPROXY_CONFIG
config wsrep 'galera'
option cluster_address ''
endef
export HAPROXY_CONFIG
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list="$prefix_list $DMROOT.HAProxy."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_HAProxy"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_HAProxy"
entry_execute_method_root_HAProxy() {
case "$1" in ""|"$DMROOT."|"$DMROOT.HAProxy."*)
common_execute_method_obj "$DMROOT.HAProxy." "0"
common_execute_method_param "$DMROOT.HAProxy.GaleraClusterAddress" "1" "HAProxy_get_cluster_address" "HAProxy_set_cluster_address"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
HAProxy_get_cluster_address() {
echo `$UCI_GET haproxy.galera.cluster_address`
}
HAProxy_set_cluster_address() {
local address=`$UCI_GET haproxy.galera.cluster_address`
if [ "$address" != "$1" ]; then
$UCI_SET haproxy.galera.cluster_address="$1"
$UCI_COMMIT
cp -f /etc/haproxy/haproxy.cfg.template /etc/haproxy/haproxy.cfg
if [ ! -z "$1" ]; then
IFS=', ' read -r -a array <<< "$1"
for pos in "${!array[@]}"
do
let "index=$pos+1"
echo -e "\tserver $index ${array[pos]}:3306 check" >> /etc/haproxy/haproxy.cfg
done
fi
systemctl reload haproxy
fi
}
bin bin
/lib/systemd/system/.* /lib/systemd/system/.*
/usr/lib/tmpfiles.d/.* /usr/lib/tmpfiles.d/.*
/usr/share/easycwmp/functions/.*
/usr/bin/.* /usr/bin/.*
/usr/sbin/.* /usr/sbin/.*
etc etc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment