This commit is contained in:
Mr Chen
2018-12-05 20:15:00 +08:00
parent afdc9720fc
commit c144cead18
15 changed files with 426 additions and 341 deletions
+4 -3
View File
@@ -1,8 +1,8 @@
<div class="bt-form">
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="redisService();">服务</p>
<p onclick="redisConfig();">配置修改</p>
<p class="bgw" onclick="pluginService('memcached');">服务</p>
<p onclick="pluginConfig('memcached');">配置修改</p>
<p onclick="redisConfig();">切换版本</p>
<p onclick="redisStatus();">负载状态</p>
<p onclick="redisStatus();">性能调整</p>
@@ -14,5 +14,6 @@
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=memcached&f=js/mem.js");
pluginService('memcached');
// $.getScript( "/plugins/file?name=memcached&f=js/mem.js");
</script>
+5 -5
View File
@@ -11,7 +11,7 @@ import public
def status():
data = public.execShell(
"ps -ef|grep redis |grep -v grep | grep -v python | awk '{print $2}'")
"ps -ef|grep memcached |grep -v grep | grep -v python | awk '{print $2}'")
if data[0] == '':
return 'stop'
return 'start'
@@ -19,8 +19,8 @@ def status():
def start():
path = os.path.dirname(os.getcwd())
cmd = path + "/redis/bin/redis-server"
cmd = cmd + " " + path + "/redis/redis.conf"
cmd = path + "/memcached/bin/memcached"
cmd = cmd + " " + path + "/memcached/memcached.conf"
data = public.execShell(cmd)
if data[0] == '':
return 'ok'
@@ -29,7 +29,7 @@ def start():
def stop():
data = public.execShell(
"ps -ef|grep redis |grep -v grep |grep -v python |awk '{print $2}' | xargs kill -9")
"ps -ef|grep memcached |grep -v grep |grep -v python |awk '{print $2}' | xargs kill -9")
if data[0] == '':
return 'ok'
return 'fail'
@@ -75,7 +75,7 @@ def runInfo():
def getConf():
path = os.path.dirname(os.getcwd()) + "/redis/redis.conf"
path = os.getcwd() + "/plugins/memcached/init.d/memcached.tpl"
return path
if __name__ == "__main__":
+81
View File
@@ -0,0 +1,81 @@
#! /bin/bash
#
# memcached: MemCached Daemon
#
# chkconfig: - 90 25
# description: MemCached Daemon
#
### BEGIN INIT INFO
# Provides: memcached
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: memcached - Memory caching daemon
# Description: memcached - Memory caching daemon
### END INIT INFO
IP=127.0.0.1
PORT=11211
USER=root
MAXCONN=1024
CACHESIZE=64
OPTIONS=""
RETVAL=0
prog="memcached"
start () {
echo -n $"Starting $prog: "
{$PATH}/memcached/bin/memcached -d -l $IP -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached.pid $OPTIONS
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
else
touch /var/lock/subsys/memcached
echo " done"
fi
}
stop () {
echo -n $"Stopping $prog: "
if [ ! -e /var/run/$prog.pid ]; then
echo -n $"$prog is not running."
exit 1
fi
kill `cat /var/run/memcached.pid`
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
else
rm -f /var/lock/subsys/memcached
rm -f /var/run/memcached.pid
echo " done"
fi
}
restart () {
$0 stop
sleep 2
$0 start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
exit $?