update
This commit is contained in:
parent
b3228a816b
commit
76e756c1e5
|
|
@ -5,6 +5,7 @@ import io
|
|||
import os
|
||||
import time
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
|
|
@ -235,11 +236,30 @@ def runStatus():
|
|||
|
||||
def sphinxCmd():
|
||||
file = getConf()
|
||||
bin_dir = getServerDir()
|
||||
content = public.readFile(file)
|
||||
print content
|
||||
rep = 'index\s(.*)'
|
||||
tmp = re.findall(rep, content)
|
||||
print tmp
|
||||
sindex = re.findall(rep, content)
|
||||
indexlen = len(sindex)
|
||||
if indexlen > 0:
|
||||
cmd = {}
|
||||
cmd_index = []
|
||||
cmd_delta = []
|
||||
for x in range(indexlen):
|
||||
if string.find(sindex[x], ':') != -1:
|
||||
t = sindex[x].split(':')
|
||||
cmd_delta.append(t[0].strip())
|
||||
else:
|
||||
cmd_index.append(sindex[x])
|
||||
|
||||
cmd['index'] = cmd_index
|
||||
cmd['delta'] = cmd_delta
|
||||
cmd['cmd'] = bin_dir + '/bin/bin/searchd -c ' + bin_dir + '/sphinx.conf'
|
||||
|
||||
return public.returnJson(True, 'ok', cmd)
|
||||
else:
|
||||
return public.returnJson(False, 'no index')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ function runStatus(){
|
|||
}
|
||||
var idata = rdata.data;
|
||||
console.log(idata);
|
||||
var Con = '<div class="divtable"><table class="table table-hover table-bordered" style="margin-bottom:10px;background-color:#fafafa">\
|
||||
var con = '<div class="divtable"><table class="table table-hover table-bordered" style="margin-bottom:10px;background-color:#fafafa">\
|
||||
<tbody>\
|
||||
<tr><th>运行时间</th><td>' + idata.uptime + 's</td><th>每秒查询</th><td>' + parseInt(parseInt(idata.queries) / parseInt(idata.uptime)) + '</td></tr>\
|
||||
<tr><th>总连接次数</th><td>' + idata.connections + '</td><th>work_queue_length</th><td>' +idata.work_queue_length + '</td></tr>\
|
||||
|
|
@ -77,13 +77,25 @@ function runStatus(){
|
|||
<tbody>\
|
||||
</table></div>';
|
||||
|
||||
$(".soft-man-con").html(Con);
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
|
||||
function readme(){
|
||||
|
||||
spPost('sphinx_cmd', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata['status']){
|
||||
layer.msg(rdata['msg'],{icon:2,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
$(".soft-man-con").html(Con);
|
||||
var con = '';
|
||||
|
||||
console.log(rdata);
|
||||
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
#
|
||||
# Minimal Sphinx configuration sample (clean, simple, functional)
|
||||
#
|
||||
|
||||
indexer
|
||||
{
|
||||
mem_limit = 218M
|
||||
}
|
||||
|
||||
searchd
|
||||
{
|
||||
listen = 9312
|
||||
listen = 9306:mysql41
|
||||
log = {$SERVER_APP}/index/searchd.log
|
||||
query_log = {$SERVER_APP}/index/query.log
|
||||
read_timeout = 5
|
||||
max_children = 0
|
||||
pid_file = {$SERVER_APP}/index/searchd.pid
|
||||
seamless_rotate = 1
|
||||
preopen_indexes = 1
|
||||
unlink_old = 1
|
||||
#workers = threads # for RT to work
|
||||
binlog_path = {$SERVER_APP}/index/binlog
|
||||
}
|
||||
Loading…
Reference in New Issue