From 6619ae0bc520986f1fa45aa9a6fa4df02aaff2aa Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 18 Nov 2023 20:13:39 +0800 Subject: [PATCH] =?UTF-8?q?haproxy=20=E9=85=8D=E7=BD=AE=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/haproxy/index.py | 7 +++++++ plugins/haproxy/js/haproxy.js | 2 +- plugins/lvs/readme.md | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 plugins/lvs/readme.md diff --git a/plugins/haproxy/index.py b/plugins/haproxy/index.py index c5ab10ef1..07becca9c 100755 --- a/plugins/haproxy/index.py +++ b/plugins/haproxy/index.py @@ -152,6 +152,13 @@ def initDreplace(): def haOp(method): file = initDreplace() + # check config + sdir = getServerDir() + cmd_check = sdir+'/sbin/haproxy -c -f ' + sdir + '/haproxy.conf' + chk_data = mw.execShell(cmd_check) + if chk_data[1]!= '': + return chk_data[1] + if not mw.isAppleSystem(): data = mw.execShell('systemctl ' + method + ' haproxy') if data[1] == '': diff --git a/plugins/haproxy/js/haproxy.js b/plugins/haproxy/js/haproxy.js index facf1e0b4..be9cd8725 100755 --- a/plugins/haproxy/js/haproxy.js +++ b/plugins/haproxy/js/haproxy.js @@ -10,7 +10,7 @@ function spPostMin(method, args, callback){ $.post('/plugins/run', req_data, function(data) { if (!data.status){ - layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + layer.msg(data.msg,{icon:0,time:10000,shade: [0.3, '#000']}); return; } diff --git a/plugins/lvs/readme.md b/plugins/lvs/readme.md new file mode 100644 index 000000000..29ef5bd64 --- /dev/null +++ b/plugins/lvs/readme.md @@ -0,0 +1,20 @@ +debian + +# 查看网卡 +ls /sys/class/net/ + +ifconfig ens256 172.16.204.100 netmask 255.255.255.255 broadcast 192.168.212.100 up + +route add -host 172.16.204.100 dev ens256 + + +ipvsadm -A -t 172.16.204.100:80 -s rr +ipvsadm -a -t 172.16.204.100:80 -r 172.16.204.129:80 -m + +# 清空LVS规则 + +ipvsadm -C + +# 查看LVS + +ipvsadm -L -n \ No newline at end of file