pull/181/head
midoks 3 years ago
parent 9a51bc4b4e
commit 29802d8066
  1. 44
      plugins/haproxy/conf/haproxy.conf
  2. 33
      plugins/haproxy/index.py
  3. 5
      plugins/haproxy/init.d/haproxy.service.tpl

@ -1,10 +1,38 @@
global
log 127.0.0.1 local
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
global
daemon
stats socket /var/lib/haproxy/stats
log 127.0.0.1 local0
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
defaults
mode http
log global
option httplog
timeout connect 10s
timeout client 15s
timeout server 15s
listen stats
mode http
bind *:10800
stats enable
stats uri /haproxy
stats realm Haproxy\ Statistics
stats auth admin:admin
frontend http-in
bind *:1080
default_backend servers
option forwardfor
option httpclose
backend servers
balance roundrobin
server web1 0.0.0.0:9090 check

@ -249,37 +249,6 @@ def runStatus():
return mw.returnJson(True, 'ok', rData)
def sphinxConfParse():
file = getConf()
bin_dir = getServerDir()
content = mw.readFile(file)
rep = 'index\s(.*)'
sindex = re.findall(rep, content)
indexlen = len(sindex)
cmd = {}
if indexlen > 0:
cmd_index = []
cmd_delta = []
for x in range(indexlen):
if sindex[x].find(':') != -1:
cmd_delta.append(sindex[x])
else:
cmd_index.append(sindex[x])
cmd['index'] = cmd_index
cmd['delta'] = cmd_delta
cmd['cmd'] = bin_dir + '/bin/bin/indexer -c ' + bin_dir + '/sphinx.conf'
return cmd
def sphinxCmd():
data = sphinxConfParse()
if 'index' in data:
return mw.returnJson(True, 'ok', data)
else:
return mw.returnJson(False, 'no index')
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
@ -310,7 +279,5 @@ if __name__ == "__main__":
print(queryLog())
elif func == 'run_status':
print(runStatus())
elif func == 'sphinx_cmd':
print(sphinxCmd())
else:
print('error')

@ -4,8 +4,9 @@ After=network.target
[Service]
Type=forking
ExecStart={$SERVER_PATH}/haproxy/sbin/haproxy -c -f {$SERVER_PATH}/haproxy/haproxy.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStartPre={$SERVER_PATH}/haproxy/sbin/haproxy -c -f {$SERVER_PATH}/haproxy/haproxy.conf
ExecStart={$SERVER_PATH}/haproxy/sbin/haproxy -Ws -f {$SERVER_PATH}/haproxy/haproxy.conf -p /run/haproxy.pid
ExecReload={$SERVER_PATH}/haproxy/sbin/haproxy -f {$SERVER_PATH}/haproxy/haproxy.conf -c -q
Restart=on-failure
[Install]

Loading…
Cancel
Save