import{_ as ue}from"./index-BGYvyLDv.js?v=1773287522785";import{_ as U}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as pe,a as de}from"./index.vue_vue_type_script_setup_true_lang-BE5ofhzm.js?v=1773287522785";import{k as M,$ as q,Z as P,a0 as s,a9 as u,_ as z,aa as m,F as S,R as N,S as o,j as k,a8 as D,r as B,X as R,e as J,P as se}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{_ as fe}from"./index.vue_vue_type_script_setup_true_lang-CgKUoL60.js?v=1773287522785";import{eK as Q,eL as $,h as V,eM as me,eN as be,eO as I,eP as ye,aq as ge,eQ as he,i as T,w as ae,C as H,eR as xe,eS as ze,eT as ve,eU as qe,ar as we,eV as Me,n as ke,eW as Z,eX as Y}from"./index-BTglIPU2.js?v=1773287522785";import{B as F,k as j,_ as oe,ad as Pe,a8 as W,a0 as E,ak as Se,aj as $e,a9 as X,a6 as Be}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{s as le}from"./php-D3q5Oj7O.js?v=1773287522785";import{u as C}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{_ as ie}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{u as _e}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{_ as Ce}from"./index-K4YGya6V.js?v=1773287522785";import{_ as ce}from"./index-lEMZglLp.js?v=1773287522785";import{o as ee}from"./logs-CbT7wTGd.js?v=1773287522785";import{a as Ie}from"./file-B5PwfK2h.js?v=1773287522785";import{u as Ne}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import"./alarm-DLi1oY_0.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-O0FWUQU9.js?v=1773287522785";import"./alarm-C8du74Vj.js?v=1773287522785";import"./index-Cy3Gp9Hk.js?v=1773287522785";import"./theme-monokai-Bqt0uTuQ.js?v=1773287522785";import"./ace-CNnfDSio.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";const Te=M({__name:"index",setup(a){return(n,e)=>{const t=U;return q(),P(S,null,[s(pe),s(t,{class:"mt-10px"},{default:u(()=>[z("li",null,m(n.$t("Plugin.Mysql.index_25")),1)]),_:1})],64)}}}),je=M({__name:"index",setup(a,{expose:n}){const{t:e}=N(),t=()=>{V({title:e("Plugin.Mysql.index_16"),content:e("Plugin.Mysql.index_17",[$.datadir]),onConfirm:async()=>{await me({datadir:$.datadir})}})};return Q(),n({init:Q}),(c,l)=>{const p=fe,i=F,b=j,h=U;return q(),P(S,null,[s(b,null,{default:u(()=>[s(p,{value:o($).datadir,"onUpdate:value":l[0]||(l[0]=_=>o($).datadir=_),class:"w-300px"},null,8,["value"]),s(i,{type:"primary",onClick:t},{default:u(()=>[k(m(c.$t("Plugin.Mysql.index_13")),1)]),_:1})]),_:1}),s(h,{class:"mt-10px"},{default:u(()=>[z("li",null,m(c.$t("Plugin.Mysql.index_14")),1),z("li",null,m(c.$t("Plugin.Mysql.index_15")),1)]),_:1})],64)}}}),Le=M({__name:"index",setup(a,{expose:n}){const e=async()=>{await be({port:$.port})};return Q(),n({init:Q}),(t,c)=>{const l=oe,p=F,i=j;return q(),D(i,null,{default:u(()=>[s(l,{class:"w-100px!","show-button":!1,value:o($).port,"onUpdate:value":c[0]||(c[0]=b=>o($).port=b),placeholder:t.$t("Site.TableRow.index_16")},null,8,["value","placeholder"]),s(p,{type:"primary",onClick:e},{default:u(()=>[k(m(t.$t("Public.Btn.Conf")),1)]),_:1})]),_:1})}}}),Re=M({__name:"index",setup(a,{expose:n}){const{t:e}=N(),t=B(!1),c=async()=>{try{await ye()}catch(_){t.value=!t.value}},l=()=>{V({title:e("Plugin.Mysql.index_22",[I.title]),content:e("Plugin.Mysql.index_24",[I.title]),onConfirm:async()=>{await le({name:"mysqld",type:"restart"})}})},p=()=>{ge(encodeURIComponent("/www/server/data/ssl.zip"))},{loading:i,setLoading:b}=C(),h=async()=>{try{b(!0);const{message:_}=await he();T(_)&&(t.value=_.status)}finally{b(!1)}};return h(),n({init:h}),(_,d)=>{const r=Pe,f=W,y=F,v=j,x=E,g=U;return q(),P(S,null,[s(r,{class:"mb-16px",type:"info"},{default:u(()=>d[1]||(d[1]=[k(" This feature will be discontinued in the next version ")])),_:1,__:[1]}),s(v,{class:"items-center"},{default:u(()=>[z("span",null,m(_.$t("Plugin.Mysql.index_30"))+" Mysql SSL",1),s(f,{value:o(t),"onUpdate:value":[d[0]||(d[0]=w=>R(t)?t.value=w:null),c],loading:o(i)},null,8,["value","loading"]),s(y,{onClick:l,type:"primary"},{default:u(()=>[k(m(_.$t("Plugin.Mysql.index_22",[o(I).title])),1)]),_:1})]),_:1}),s(x,{class:"my-16px!"}),s(g,{class:"mb-16px"},{default:u(()=>[z("li",null,m(_.$t("Database.Mysql.index_27")),1),z("li",null,[k(m(_.$t("Database.Mysql.index_28"))+" ",1),z("a",{class:"bt-link",onClick:p},"【SSL.zip】")])]),_:1})],64)}}}),Ue=[{label:"Launch Time",value:"Run",isTime:!0},{label:"Total Connections",value:"Connections"},{label:"Send",value:"Bytes_sent",isSize:!0},{label:"Receive",value:"Bytes_received",isSize:!0},{label:"Query per second",value:"query"},{label:"Transaction per second",value:"transaction"},{label:"File",value:"File"},{label:"Position",value:"Position"}],ne=[{name:"Active/Max connections",function:a=>a.Threads_running+"/"+a.Max_used_connections,value:"",ps:"If too high, increase max_connections"},{name:"Thread cache hit rate",value:"",function:a=>{const n=((1-Number(a.Threads_created)/Number(a.Connections))*100).toFixed(2);return n?n+"%":"0"},ps:"If too low, increase thread_cache_size"},{value:"",name:"Index hit rate",function:a=>{const n=Number(a.Key_reads),e=Number(a.Key_read_requests);return(e>0?((1-n/e)*100).toFixed(2):"0.00")+"%"},ps:"If too low, increase key_buffer_size"},{value:"",name:"Innodb index hit rate",function:a=>{const n=((1-Number(a.Innodb_buffer_pool_reads)/Number(a.Innodb_buffer_pool_read_requests))*100).toFixed(2);return n||"0"},ps:"If too low, increase innodb_buffer_pool_size"},{value:"",name:"Query cache hit rate",function:a=>{let n=(parseInt(a.Qcache_hits)/(parseInt(a.Qcache_hits)+parseInt(a.Qcache_inserts))*100).toFixed(2)+"%";return n=="NaN%"&&(n="OFF"),n},ps:"If too low, increase query_cache_size"},{value:"",name:"Created temporary tables to disk",function:a=>{const n=(Number(a.Created_tmp_disk_tables)/Number(a.Created_tmp_tables)*100).toFixed(2);return n?n+"%":"0"},ps:"If too high, increase tmp_table_size"},{value:"",name:"Opened table",function:a=>a.Open_tables,ps:"If too high, increase table_open_cache"},{value:"",name:"Amount unindexed",function:a=>a.Select_full_join,ps:"If not 0, please check index of database table"},{value:"",name:"Amount unindexed in table join",function:a=>a.Select_range_check,ps:"If not 0, please check index of database table"},{value:"",name:"Number of merges after sorting",function:a=>a.Sort_merge_passes,ps:"If too high, increase sort_buffer_size"},{value:"",name:"Number of lock tables",function:a=>a.Table_locks_waited,ps:"If too high, consider increase your database performance"}],De=M({__name:"index",setup(a,{expose:n}){const{t:e}=N(),t=J({}),{table:c,columns:l}=_e([{title:e("Plugin.Apache.index_12"),key:"name",width:"30%"},{title:e("Plugin.Apache.index_13"),key:"value",width:"20%"},{title:e("Public.Table.Note"),key:"ps",ellipsis:{tooltip:!0}}]),p=_=>{if(_.value==="query")return parseInt((Number(t.Questions)/Number(t.Uptime)).toString());if(_.value==="transaction")return parseInt(((parseInt(t.Com_commit)+parseInt(t.Com_rollback))/Number(t.Uptime)).toString());const d=t[_.value];return d===void 0?"--":_.isTime?ae(d):_.isSize?H(d):d},{loading:i,setLoading:b}=C(),h=async()=>{try{b(!0);const{message:_}=await xe();T(_)&&(Object.assign(t,_),ne.forEach(d=>{d.function&&(d.value=d.function(t))}),c.data=ne)}finally{b(!1)}};return h(),n({init:h}),(_,d)=>{const r=$e,f=Se,y=X,v=ie;return q(),P(S,null,[s(y,{show:o(i)},{default:u(()=>[s(f,{"label-placement":"left",bordered:"",column:2},{default:u(()=>[(q(!0),P(S,null,se(o(Ue),x=>(q(),D(r,{label:x.label,key:x.value},{default:u(()=>[k(m(p(x)),1)]),_:2},1032,["label"]))),128))]),_:1})]),_:1},8,["show"]),s(v,{class:"mt-10px",loading:o(i),data:o(c).data,columns:o(l)},null,8,["loading","data","columns"])],64)}}}),Fe=[{label:"1-2GB",value:"1-2GB",data:{key_buffer_size:32,query_cache_size:32,tmp_table_size:32,innodb_buffer_pool_size:64,sort_buffer_size:256,read_buffer_size:256,read_rnd_buffer_size:256,join_buffer_size:512,thread_stack:256,binlog_cache_size:64,thread_cache_size:64,table_open_cache:128,max_connections:100}},{label:"2-4GB",value:"2-4GB",data:{key_buffer_size:64,query_cache_size:64,tmp_table_size:64,innodb_buffer_pool_size:128,sort_buffer_size:512,read_buffer_size:512,read_rnd_buffer_size:512,join_buffer_size:1024,thread_stack:256,binlog_cache_size:64,thread_cache_size:96,table_open_cache:192,max_connections:200}},{label:"4-8GB",value:"4-8GB",data:{key_buffer_size:128,query_cache_size:128,tmp_table_size:128,innodb_buffer_pool_size:256,sort_buffer_size:1024,read_buffer_size:1024,read_rnd_buffer_size:768,join_buffer_size:2048,thread_stack:256,binlog_cache_size:128,thread_cache_size:128,table_open_cache:384,max_connections:300}},{label:"8-16GB",value:"8-16GB",data:{key_buffer_size:256,query_cache_size:256,tmp_table_size:256,innodb_buffer_pool_size:512,sort_buffer_size:1024,read_buffer_size:2048,read_rnd_buffer_size:1024,join_buffer_size:2048,thread_stack:384,binlog_cache_size:192,thread_cache_size:192,table_open_cache:1024,max_connections:400}},{label:"16-32GB",value:"16-32GB",data:{key_buffer_size:1024,query_cache_size:384,tmp_table_size:1024,innodb_buffer_pool_size:1024,sort_buffer_size:4096,read_buffer_size:4096,read_rnd_buffer_size:2048,join_buffer_size:4096,thread_stack:512,binlog_cache_size:256,thread_cache_size:256,table_open_cache:2048,max_connections:500}}],te={key_buffer_size:"MB, Buffer size for indexing",query_cache_size:"MB, Query cache, set to 0 for not enabled",tmp_table_size:"MB, Temporary table cache size",innodb_buffer_pool_size:"MB, Innodb buffer size",innodb_log_buffer_size:"MB, Innodb log buffer size",sort_buffer_size:"KB * Num of connections, Buffer size per thread sort",read_buffer_size:"KB * Num of connections, Read buffer size",read_rnd_buffer_size:"KB * Num of connections, Random read buffer size",join_buffer_size:"KB * Num of connections, Join table buffer size",thread_stack:"KB * Num of connections, Stack size per thread",binlog_cache_size:"KB * Num of connections, Bin log cache size (multiples of 4096)",thread_cache_size:"Thread cache size",table_open_cache:"Table open cache (NOT exceed 2048 at most)",max_connections:"Max connections"},Ge={class:"w-150px!"},Ae={class:"w-250px! color-#666"},Ke={class:"color-#666"},Oe=M({__name:"index",setup(a,{expose:n}){const{t:e}=N(),t=B(),c=B(),l=J({}),p=(f,y)=>{for(const v in y.data)l[v]=y.data[v];i()},i=()=>{const f=new Set(["key_buffer_size","query_cache_size","tmp_table_size","innodb_buffer_pool_size","innodb_log_buffer_size"]),y=new Set(["sort_buffer_size","read_buffer_size","read_rnd_buffer_size","join_buffer_size","thread_stack","binlog_cache_size"]),v=Number(l.max_connections||0),{a:x,b:g}=Object.entries(l).reduce((w,[G,A])=>{const K=Number(A);return f.has(G)?w.a+=K:y.has(G)&&(w.b+=K/1024),w},{a:0,b:0});c.value=(x+g*v).toString()},b=async()=>{const f={...l,query_cache_type:l.query_cache_size>0?1:0,max_heap_table_size:l.tmp_table_size};await ze(f),i()},h=()=>{V({title:e("Plugin.Mysql.index_22",[I.title]),content:e("Plugin.Mysql.index_24",[I.title]),onConfirm:async()=>{await le({name:"mysqld",type:"restart"})}})},{loading:_,setLoading:d}=C(),r=async()=>{var f,y,v;try{d(!0),t.value=null;const{message:x}=await ve();if(T(x)){const g=x.mem;(f=g.join_buffer_size)!=null||(g.join_buffer_size=512),(y=g.thread_stack)!=null||(g.thread_stack=256),(v=g.binlog_cache_size)!=null||(g.binlog_cache_size=32);for(const w in te)w in g&&(l[w]=g[w]);i()}}finally{d(!1)}};return r(),n({init:r}),(f,y)=>{const v=Be,x=j,g=Ce,w=E,G=oe,A=F,K=X;return q(),P(S,null,[s(x,{class:"justify-center!"},{default:u(()=>[s(x,{class:"items-center"},{default:u(()=>[z("span",null,m(f.$t("Plugin.Mysql.index_20")),1),s(v,{class:"w-150px",value:o(t),"onUpdate:value":[y[0]||(y[0]=O=>R(t)?t.value=O:null),p],options:o(Fe),placeholder:f.$t("Ftp.Placeholder.Index_2")},null,8,["value","options","placeholder"])]),_:1}),s(x,{class:"items-center"},{default:u(()=>[k(m(f.$t("Plugin.Mysql.index_21")),1),s(g,{text:"MB",class:"w-150px!",value:o(c),"onUpdate:value":y[1]||(y[1]=O=>R(c)?c.value=O:null),readonly:""},null,8,["value"])]),_:1})]),_:1}),s(w,{class:"my-10px!"}),s(K,{show:o(_)},{default:u(()=>[(q(!0),P(S,null,se(o(l),(O,L)=>(q(),D(x,{class:"items-center flex-nowrap! py-2px",key:L},{default:u(()=>[z("div",Ge,m(L),1),s(G,{class:"w-150px!",value:o(l)[L],"onUpdate:value":re=>o(l)[L]=re,min:0,"show-button":!1},null,8,["value","onUpdate:value"]),z("div",Ae,m(o(te)[L]),1)]),_:2},1024))),128)),s(x,{class:"items-center justify-center! mt-10px"},{default:u(()=>[s(A,{type:"primary",onClick:b},{default:u(()=>[k(m(f.$t("Public.Btn.Save")),1)]),_:1}),s(A,{onClick:h},{default:u(()=>[k(m(f.$t("Plugin.Mysql.index_22",[o(I).title])),1)]),_:1}),z("span",Ke,"*"+m(f.$t("Plugin.Mysql.index_23")),1)]),_:1})]),_:1},8,["show"])],64)}}}),Qe=M({__name:"index",setup(a,{expose:n}){const e=B("None"),{loading:t,setLoading:c}=C(),l=async()=>{await ee({close:1}),p()},p=async()=>{try{c(!0);const{message:i}=await ee();T(i)&&(e.value=i.result?i.result:"None")}finally{c(!1)}};return p(),n({init:p}),(i,b)=>{const h=F,_=ce,d=X;return q(),P(S,null,[s(h,{class:"mb-10px",onClick:l},{default:u(()=>[k(m(i.$t("Crontab.Planned.index_25")),1)]),_:1}),s(d,{class:"h-580px",show:o(t)},{default:u(()=>[s(_,{log:o(e)},null,8,["log"])]),_:1},8,["show"])],64)}}}),Ve=M({__name:"index",setup(a,{expose:n}){const e=B("None"),{loading:t,setLoading:c}=C(),l=async()=>{try{c(!0);const{message:p}=await qe();T(p)&&(e.value=p.result?p.result:"None")}finally{c(!1)}};return l(),n({init:l}),(p,i)=>{const b=ce,h=X;return q(),D(h,{class:"h-610px",show:o(t)},{default:u(()=>[s(b,{log:o(e)},null,8,["log"])]),_:1},8,["show"])}}}),Ee={class:"ml-20px"},Xe=M({__name:"index",setup(a,{expose:n}){const{t:e}=N(),t=J({binlog_status:!1,size:0}),{table:c,columns:l}=_e([{key:"name",title:e("Site.TableRow.index_22")},{key:"title",title:e("Site.TableRow.index_23"),render:r=>H(r.size)},{key:"title",title:e("Plugin.Mysql.index_8"),render:r=>ae(r.last_modified)},Ne({width:70,options:r=>[{label:e("Public.Btn.Del"),onClick:()=>{we({title:e("Plugin.Mysql.index_9"),content:e("Plugin.Mysql.index_10",[r.name]),onConfirm:async()=>{await Ie({path:r.path}),_()}})}}]})]),p=r=>{const f=e(r?"Public.Confirm.Enable":"Public.Status.Disable"),y=e(r?"Plugin.Mysql.index_11":"Plugin.Mysql.index_12");V({title:"".concat(f," ").concat(e("Plugin.Mysql.index_6")),content:y,onConfirm:async()=>{await Z(),h()}})},{loading:i,setLoading:b}=C(),h=async()=>{const{message:r}=await Z({status:1});T(r)&&(t.binlog_status=r.binlog_status,t.size=r.size)},_=async()=>{try{b(!0);const{message:r}=await Me();ke(r)&&(c.data=r)}finally{b(!1)}},d=()=>{h(),_()};return d(),n({init:d}),(r,f)=>{const y=W,v=j,x=E,g=U,w=ie;return q(),P(S,null,[s(v,{class:"items-center"},{default:u(()=>[z("span",null,m(r.$t("Plugin.Mysql.index_6")),1),s(y,{value:o(t).binlog_status,loading:o(i),"onUpdate:value":p},null,8,["value","loading"]),z("span",Ee,m(o(H)(o(t).size)),1)]),_:1}),s(x,{class:"my-16px!"}),s(g,{class:"mb-16px"},{default:u(()=>[z("li",null,m(r.$t("Plugin.Mysql.index_7")),1)]),_:1}),s(w,{loading:o(i),data:o(c).data,columns:o(l),"max-height":400},null,8,["loading","data","columns"])],64)}}}),He=M({__name:"index",setup(a,{expose:n}){const e=B(!1),t=async i=>{await Y({status:i?1:0}),p()},{loading:c,setLoading:l}=C(),p=async()=>{try{l(!0),await Y(),e.value=!0}catch(i){e.value=!1}finally{l(!1)}};return p(),n({init:p}),(i,b)=>{const h=W,_=j,d=E,r=U;return q(),P(S,null,[s(_,{class:"items-center"},{default:u(()=>[z("span",null,m(i.$t("Plugin.Mysql.index_18")),1),s(h,{value:o(e),"onUpdate:value":[b[0]||(b[0]=f=>R(e)?e.value=f:null),t],loading:o(c)},null,8,["value","loading"])]),_:1}),s(d,{class:"my-16px!"}),s(r,{class:"mb-16px"},{default:u(()=>[z("li",null,m(i.$t("Plugin.Mysql.index_19")),1)]),_:1})],64)}}}),kn=M({__name:"index",setup(a){const{t:n}=N(),e=B("service"),t=[{key:"service",label:n("Security.History.Index_10"),component:Te},{key:"file",label:n("Site.Config.index_15"),data:{path:"/etc/my.cnf"},component:de},{key:"location",label:n("Plugin.Mysql.index_26"),component:je},{key:"port",label:n("Site.TableRow.index_16"),component:Le},{key:"ssl",label:"SSL",show:!1,component:Re},{key:"status",label:n("Docker.Setting.index_2"),component:De},{key:"optimization",label:n("Plugin.Mysql.index_27"),component:Oe},{key:"logs",label:n("Site.Config.index_101"),component:Qe},{key:"slow",label:n("Plugin.Mysql.index_28"),component:Ve},{key:"binary",label:n("Plugin.Mysql.index_6"),component:Xe},{key:"memory",label:n("Plugin.Mysql.index_18"),component:He}];return(c,l)=>{const p=ue;return q(),D(p,{value:o(e),"onUpdate:value":l[0]||(l[0]=i=>R(e)?e.value=i:null),data:t},null,8,["value"])}}});export{kn as default};