From a111e04c650053a3b97b580d89380df36274725c Mon Sep 17 00:00:00 2001 From: ssongliu Date: Fri, 4 Nov 2022 19:02:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=20aof=20=E5=A4=87?= =?UTF-8?q?=E4=BB=BD=E6=81=A2=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mysql/5.7.39/conf/my.cnf | 108 ++--- backend/app/api/v1/database_mysql.go | 11 +- backend/app/dto/database.go | 34 +- backend/app/service/cronjob_helper.go | 15 + backend/app/service/database_mysql.go | 117 +++-- backend/app/service/database_redis.go | 43 +- backend/app/service/database_test.go | 68 ++- backend/router/ro_database.go | 2 +- frontend/src/api/interface/database.ts | 8 + frontend/src/api/modules/database.ts | 4 +- .../src/components/confirm-dialog/index.vue | 60 +++ .../src/components/container-log/index.vue | 111 +++++ frontend/src/lang/modules/zh.ts | 8 +- .../views/database/mysql/setting/index.vue | 433 ++---------------- .../database/mysql/setting/slow-log/index.vue | 40 ++ .../database/mysql/setting/status/index.vue | 185 ++++++++ .../mysql/setting/variables/index.vue | 285 ++++++++++++ .../database/redis/persistence/index.vue | 30 +- .../views/database/redis/setting/index.vue | 45 +- 19 files changed, 981 insertions(+), 626 deletions(-) create mode 100644 frontend/src/components/confirm-dialog/index.vue create mode 100644 frontend/src/components/container-log/index.vue create mode 100644 frontend/src/views/database/mysql/setting/slow-log/index.vue create mode 100644 frontend/src/views/database/mysql/setting/status/index.vue create mode 100644 frontend/src/views/database/mysql/setting/variables/index.vue diff --git a/apps/mysql/5.7.39/conf/my.cnf b/apps/mysql/5.7.39/conf/my.cnf index 7be15c415..24f6dd8ed 100644 --- a/apps/mysql/5.7.39/conf/my.cnf +++ b/apps/mysql/5.7.39/conf/my.cnf @@ -1,83 +1,37 @@ - -[client] -port = 3306 -socket = /var/run/mysqld/mysqld.sock - -[mysqld_safe] -socket = /var/run/mysqld/mysqld.sock -nice = 0 +# For advice on how to change settings please see +# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld] -user = mysql -pid-file = /var/run/mysqld/mysqld.pid -socket = /var/run/mysqld/mysqld.sock -port = 3306 -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -lc-messages-dir = /usr/share/mysql -skip-external-locking -skip-character-set-client-handshake -default-storage-engine = InnoDB -character-set-server = utf8 -transaction-isolation = READ-COMMITTED +# +# Remove leading # and set to the amount of RAM for the most important data +# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. +# innodb_buffer_pool_size = 128M +# +# Remove leading # to turn on a very important data integrity option: logging +# changes to the binary log between backups. +# log_bin +# +# Remove leading # to set options mainly useful for reporting servers. +# The server defaults are faster for transactions and fast SELECTs. +# Adjust sizes as needed, experiment to find the optimal values. +# join_buffer_size = 128M +# sort_buffer_size = 2M +# read_rnd_buffer_size = 2M +skip-host-cache +skip-name-resolve +datadir=/var/lib/mysql +socket=/var/run/mysqld/mysqld.sock +secure-file-priv=/var/lib/mysql-files +user=mysql +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 -bind-address = 127.0.0.1 -key_buffer = 16M -max_allowed_packet = 16M -thread_stack = 192K -thread_cache_size = 16 -myisam-recover = BACKUP -max_connections = 300 -table_open_cache = 64 -thread_concurrency = 10 -table_open_cache = 32 -thread_concurrency = 4 +#log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid -query_cache_type = 1 -query_cache_limit = 1M -query_cache_size = 8M -general_log_file = /var/log/mysql/mysql.log -#general_log = 1 -log_error = /var/log/mysql/error.log +[client] +socket=/var/run/mysqld/mysqld.sock -slow_query_log = 1 -slow_query_log_file = /var/log/mysql/mysql-slow.log -long_query_time = 1 -#log-queries-not-using-indexes - - -#server-id = 1 -#log_bin = /var/log/mysql/mysql-bin.log -expire_logs_days = 14 -max_binlog_size = 1G -#binlog_do_db = include_database_name -#binlog_ignore_db = include_database_name - - -# ssl-ca=/etc/mysql/cacert.pem -# ssl-cert=/etc/mysql/server-cert.pem -# ssl-key=/etc/mysql/server-key.pem -innodb_data_file_path = ibdata1:128M:autoextend -innodb_file_per_table = 1 -skip-innodb_doublewrite -innodb_additional_mem_pool_size = 12M -innodb_buffer_pool_size = 256M -innodb_log_buffer_size = 8M -innodb_log_file_size = 8M -innodb_flush_log_at_trx_commit = 0 -innodb_flush_method = O_DIRECT -innodb_support_xa = OFF - - -[mysqldump] -quick -quote-names -max_allowed_packet = 16M - -[mysql] -#no-auto-rehash # faster start of mysql but no tab completition - -[isamchk] -key_buffer = 16M +!includedir /etc/mysql/conf.d/ +!includedir /etc/mysql/mysql.conf.d/ \ No newline at end of file diff --git a/backend/app/api/v1/database_mysql.go b/backend/app/api/v1/database_mysql.go index 3f41f3bb1..1966a10bf 100644 --- a/backend/app/api/v1/database_mysql.go +++ b/backend/app/api/v1/database_mysql.go @@ -48,16 +48,19 @@ func (b *BaseApi) UpdateMysql(c *gin.Context) { } func (b *BaseApi) UpdateMysqlVariables(c *gin.Context) { - var req dto.MysqlVariablesUpdate + var req []dto.MysqlVariablesUpdate if err := c.ShouldBindJSON(&req); err != nil { helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) return } - if err := global.VALID.Struct(req); err != nil { - helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) + + mysqlName, ok := c.Params.Get("mysqlName") + if !ok { + helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, errors.New("error mysqlName in path")) return } - if err := mysqlService.UpdateVariables(req); err != nil { + + if err := mysqlService.UpdateVariables(mysqlName, req); err != nil { helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) return } diff --git a/backend/app/dto/database.go b/backend/app/dto/database.go index 8abe74f18..cba13835b 100644 --- a/backend/app/dto/database.go +++ b/backend/app/dto/database.go @@ -78,26 +78,15 @@ type MysqlVariables struct { TableOpenCache string `json:"table_open_cache"` ThreadCacheSize string `json:"thread_cache_size"` ThreadStack string `json:"thread_stack"` - Tmp_tableSize string `json:"tmp_table_size"` + TmpTableSize string `json:"tmp_table_size"` + + SlowQueryLog string `json:"slow_query_log"` + LongQueryTime string `json:"long_query_time"` } type MysqlVariablesUpdate struct { - MysqlName string `json:"mysqlName" validate:"required"` - KeyBufferSize int64 `json:"key_buffer_size" validate:"required"` - QueryCacheSize int64 `json:"query_cache_size" validate:"required"` - TmpTableSize int64 `json:"tmp_table_size" validate:"required"` - InnodbBufferPoolSize int64 `json:"innodb_buffer_pool_size" validate:"required"` - InnodbLogBufferSize int64 `json:"innodb_log_buffer_size" validate:"required"` - SortBufferSize int64 `json:"sort_buffer_size" validate:"required"` - ReadBufferSize int64 `json:"read_buffer_size" validate:"required"` - - ReadRndBufferSize int64 `json:"read_rnd_buffer_size" validate:"required"` - JoinBufferSize int64 `json:"join_buffer_size" validate:"required"` - ThreadStack int64 `json:"thread_stack" validate:"required"` - BinlogCachSize int64 `json:"binlog_cache_size" validate:"required"` - ThreadCacheSize int64 `json:"thread_cache_size" validate:"required"` - TableOpenCache int64 `json:"table_open_cache" validate:"required"` - MaxConnections int64 `json:"max_connections" validate:"required"` + Param string `json:"param"` + Value interface{} `json:"value"` } type MysqlConfUpdateByFile struct { MysqlName string `json:"mysqlName" validate:"required"` @@ -112,11 +101,12 @@ type ChangeDBInfo struct { } type DBBaseInfo struct { - Name string `json:"name"` - Port int64 `json:"port"` - Password string `json:"password"` - RemoteConn bool `json:"remoteConn"` - MysqlKey string `json:"mysqlKey"` + Name string `json:"name"` + ContainerName string `json:"containerName"` + Port int64 `json:"port"` + Password string `json:"password"` + RemoteConn bool `json:"remoteConn"` + MysqlKey string `json:"mysqlKey"` } type SearchDBWithPage struct { diff --git a/backend/app/service/cronjob_helper.go b/backend/app/service/cronjob_helper.go index 4fdd85869..32ab1949c 100644 --- a/backend/app/service/cronjob_helper.go +++ b/backend/app/service/cronjob_helper.go @@ -205,3 +205,18 @@ func handleTar(sourceDir, targetDir, name, exclusionRules string) error { } return nil } + +func handleUnTar(sourceFile, targetDir string) error { + if _, err := os.Stat(targetDir); err != nil && os.IsNotExist(err) { + if err = os.MkdirAll(targetDir, os.ModePerm); err != nil { + return err + } + } + + cmd := exec.Command("tar", "zxvfC", sourceFile, targetDir) + stdout, err := cmd.CombinedOutput() + if err != nil { + return errors.New(string(stdout)) + } + return nil +} diff --git a/backend/app/service/database_mysql.go b/backend/app/service/database_mysql.go index 0e6277492..c03f57f16 100644 --- a/backend/app/service/database_mysql.go +++ b/backend/app/service/database_mysql.go @@ -4,8 +4,10 @@ import ( "compress/gzip" "encoding/json" "fmt" + "io/ioutil" "os" "os/exec" + "regexp" "strconv" "strings" "time" @@ -14,6 +16,7 @@ import ( "github.com/1Panel-dev/1Panel/backend/app/model" "github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/global" + "github.com/1Panel-dev/1Panel/backend/utils/compose" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/copier" "github.com/pkg/errors" @@ -27,7 +30,7 @@ type IMysqlService interface { SearchBackupsWithPage(search dto.SearchBackupsWithPage) (int64, interface{}, error) Create(mysqlDto dto.MysqlDBCreate) error ChangeInfo(info dto.ChangeDBInfo) error - UpdateVariables(variables dto.MysqlVariablesUpdate) error + UpdateVariables(mysqlName string, updatas []dto.MysqlVariablesUpdate) error Backup(db dto.BackupDB) error Recover(db dto.RecoverDB) error @@ -265,53 +268,41 @@ func (u *MysqlService) ChangeInfo(info dto.ChangeDBInfo) error { return nil } -func (u *MysqlService) UpdateVariables(variables dto.MysqlVariablesUpdate) error { - app, err := mysqlRepo.LoadBaseInfoByName(variables.MysqlName) +func (u *MysqlService) UpdateVariables(mysqlName string, updatas []dto.MysqlVariablesUpdate) error { + app, err := mysqlRepo.LoadBaseInfoByName(mysqlName) + if err != nil { + return err + } + var files []string + + path := fmt.Sprintf("%s/%s/%s/conf/my.cnf", constant.AppInstallDir, app.Key, app.Name) + lineBytes, err := ioutil.ReadFile(path) + if err != nil { + return err + } else { + files = strings.Split(string(lineBytes), "\n") + } + group := "" + for _, info := range updatas { + switch info.Param { + case "key_buffer_size", "sort_buffer_size": + group = "[myisamchk]" + default: + group = "[mysqld]" + } + files = updateMyCnf(files, group, info.Param, info.Value) + } + file, err := os.OpenFile(path, os.O_WRONLY, 0666) + if err != nil { + return err + } + defer file.Close() + _, err = file.WriteString(strings.Join(files, "\n")) if err != nil { return err } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL key_buffer_size=%d", variables.KeyBufferSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL query_cache_size=%d", variables.QueryCacheSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL tmp_table_size=%d", variables.TmpTableSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL innodb_buffer_pool_size=%d", variables.InnodbBufferPoolSize)); err != nil { - return err - } - // if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL innodb_log_buffer_size=%d", variables.InnodbLogBufferSize)); err != nil { - // return err - // } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL sort_buffer_size=%d", variables.SortBufferSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL read_buffer_size=%d", variables.ReadBufferSize)); err != nil { - return err - } - - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL read_rnd_buffer_size=%d", variables.ReadRndBufferSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL join_buffer_size=%d", variables.JoinBufferSize)); err != nil { - return err - } - // if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL thread_stack=%d", variables.ThreadStack)); err != nil { - // return err - // } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL binlog_cache_size=%d", variables.BinlogCachSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL thread_cache_size=%d", variables.ThreadCacheSize)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL table_open_cache=%d", variables.TableOpenCache)); err != nil { - return err - } - if err := excuteSql(app.ContainerName, app.Password, fmt.Sprintf("set GLOBAL max_connections=%d", variables.MaxConnections)); err != nil { + if _, err := compose.Restart(fmt.Sprintf("%s/%s/%s/docker-compose.yml", constant.AppInstallDir, app.Key, app.Name)); err != nil { return err } @@ -324,6 +315,7 @@ func (u *MysqlService) LoadBaseInfo(name string) (*dto.DBBaseInfo, error) { if err != nil { return nil, err } + data.ContainerName = app.ContainerName data.Name = app.Name data.Port = int64(app.Port) data.Password = app.Password @@ -485,3 +477,40 @@ func backupMysql(backupType, baseDir, backupDir, mysqlName, dbName, fileName str } return nil } + +func updateMyCnf(oldFiles []string, group string, param string, value interface{}) []string { + isOn := false + hasKey := false + regItem, _ := regexp.Compile(`\[*\]`) + var newFiles []string + for _, line := range oldFiles { + if strings.HasPrefix(line, group) { + isOn = true + newFiles = append(newFiles, line) + continue + } + if !isOn { + newFiles = append(newFiles, line) + continue + } + if strings.HasPrefix(line, param) || strings.HasPrefix(line, "# "+param) { + newFiles = append(newFiles, fmt.Sprintf("%s=%v", param, value)) + hasKey = true + continue + } + isDeadLine := regItem.Match([]byte(line)) + if !isDeadLine { + newFiles = append(newFiles, line) + continue + } + if !hasKey { + newFiles = append(newFiles, fmt.Sprintf("%s=%v\n", param, value)) + newFiles = append(newFiles, line) + } + } + if !isOn { + newFiles = append(newFiles, group+"\n") + newFiles = append(newFiles, fmt.Sprintf("%s=%v\n", param, value)) + } + return newFiles +} diff --git a/backend/app/service/database_redis.go b/backend/app/service/database_redis.go index 085c6719f..58623de21 100644 --- a/backend/app/service/database_redis.go +++ b/backend/app/service/database_redis.go @@ -177,8 +177,6 @@ func (u *RedisService) Backup() error { if stdout, err := cmd.CombinedOutput(); err != nil { return errors.New(string(stdout)) } - name := fmt.Sprintf("%s.rdb", time.Now().Format("20060102150405")) - backupLocal, err := backupRepo.Get(commonRepo.WithByType("LOCAL")) if err != nil { return err @@ -187,7 +185,6 @@ func (u *RedisService) Backup() error { if err != nil { return err } - backupDir := fmt.Sprintf("database/redis/%s/", redisInfo.Name) fullDir := fmt.Sprintf("%s/%s", localDir, backupDir) if _, err := os.Stat(fullDir); err != nil && os.IsNotExist(err) { @@ -197,6 +194,21 @@ func (u *RedisService) Backup() error { } } } + + appendonly, err := configGetStr(redisInfo.ContainerName, redisInfo.Password, "appendonly") + if err != nil { + return err + } + if appendonly == "yes" { + redisDataDir := fmt.Sprintf("%s/%s/%s/data", constant.AppInstallDir, "redis", redisInfo.Name) + name := fmt.Sprintf("%s.tar.gz", time.Now().Format("20060102150405")) + if err := handleTar(redisDataDir+"/appendonlydir", fullDir, name, ""); err != nil { + return err + } + return nil + } + + name := fmt.Sprintf("%s.rdb", time.Now().Format("20060102150405")) cmd2 := exec.Command("docker", "cp", fmt.Sprintf("%s:/data/dump.rdb", redisInfo.ContainerName), fmt.Sprintf("%s/%s", fullDir, name)) if stdout, err := cmd2.CombinedOutput(); err != nil { return errors.New(string(stdout)) @@ -209,18 +221,29 @@ func (u *RedisService) Recover(req dto.RedisBackupRecover) error { if err != nil { return err } + appendonly, err := configGetStr(redisInfo.ContainerName, redisInfo.Password, "appendonly") + if err != nil { + return err + } + composeDir := fmt.Sprintf("%s/redis/%s", constant.AppInstallDir, redisInfo.Name) if _, err := compose.Down(composeDir + "/docker-compose.yml"); err != nil { return err } - fullName := fmt.Sprintf("%s/%s", req.FileDir, req.FileName) - input, err := ioutil.ReadFile(fullName) - if err != nil { - return err - } - if err = ioutil.WriteFile(composeDir+"/data/dump.rdb", input, 0640); err != nil { - return err + if appendonly == "yes" { + redisDataDir := fmt.Sprintf("%s/%s/%s/data/", constant.AppInstallDir, "redis", redisInfo.Name) + if err := handleUnTar(fullName, redisDataDir); err != nil { + return err + } + } else { + input, err := ioutil.ReadFile(fullName) + if err != nil { + return err + } + if err = ioutil.WriteFile(composeDir+"/data/dump.rdb", input, 0640); err != nil { + return err + } } if _, err := compose.Up(composeDir + "/docker-compose.yml"); err != nil { return err diff --git a/backend/app/service/database_test.go b/backend/app/service/database_test.go index d07b82456..d9dea31ee 100644 --- a/backend/app/service/database_test.go +++ b/backend/app/service/database_test.go @@ -1,35 +1,65 @@ package service import ( - "encoding/json" "fmt" - "os/exec" + "io/ioutil" + "os" + "regexp" "strings" "testing" - - "github.com/1Panel-dev/1Panel/backend/app/dto" ) func TestMysql(t *testing.T) { - cmd := exec.Command("docker", "exec", "1Panel-redis-7.0.5-zgVH-K859", "redis-cli", "config", "get", "save") - stdout, err := cmd.CombinedOutput() - if err != nil { - fmt.Println(string(stdout)) - } + path := "/Users/slooop/go/src/github.com/1Panel/apps/mysql/5.7.39/conf/my.cnf" - rows := strings.Split(string(stdout), "\r\n") - rowMap := make(map[string]string) - for _, v := range rows { - itemRow := strings.Split(v, "\n") - if len(itemRow) == 3 { - rowMap[itemRow[0]] = itemRow[1] + var lines []string + lineBytes, err := ioutil.ReadFile(path) + if err != nil { + fmt.Println(err) + } else { + lines = strings.Split(string(lineBytes), "\n") + } + var newLines []string + + start := "[mysqld]" + isOn := false + hasKey := false + regItem, _ := regexp.Compile(`^\[*\]`) + i := 0 + for _, line := range lines { + i++ + if strings.HasPrefix(line, start) { + isOn = true + newLines = append(newLines, line) + continue + } + if !isOn { + newLines = append(newLines, line) + continue + } + if strings.HasPrefix(line, "user") || strings.HasPrefix(line, "# user") { + newLines = append(newLines, "user="+"ON") + hasKey = true + continue + } + isDeadLine := regItem.Match([]byte(line)) + if !isDeadLine { + newLines = append(newLines, line) + continue + } + if !hasKey { + newLines = append(newLines, "user="+"ON \n") + newLines = append(newLines, line) } } - var info dto.RedisStatus - arr, err := json.Marshal(rowMap) + + file, err := os.OpenFile(path, os.O_WRONLY, 0666) + if err != nil { + fmt.Println(err) + } + defer file.Close() + _, err = file.WriteString(strings.Join(newLines, "\n")) if err != nil { fmt.Println(err) } - _ = json.Unmarshal(arr, &info) - fmt.Println(info) } diff --git a/backend/router/ro_database.go b/backend/router/ro_database.go index e2e62de29..60b1b0daf 100644 --- a/backend/router/ro_database.go +++ b/backend/router/ro_database.go @@ -27,7 +27,7 @@ func (s *DatabaseRouter) InitDatabaseRouter(Router *gin.RouterGroup) { withRecordRouter.POST("/recover", baseApi.RecoverMysql) withRecordRouter.POST("/backups/search", baseApi.SearchDBBackups) withRecordRouter.POST("/del", baseApi.DeleteMysql) - withRecordRouter.POST("/variables/update", baseApi.UpdateMysqlVariables) + withRecordRouter.POST("/variables/update/:mysqlName", baseApi.UpdateMysqlVariables) withRecordRouter.POST("/conf/update/byfile", baseApi.UpdateMysqlConfByFile) cmdRouter.POST("/search", baseApi.SearchMysql) cmdRouter.GET("/variables/:name", baseApi.LoadVariables) diff --git a/frontend/src/api/interface/database.ts b/frontend/src/api/interface/database.ts index f3be93a90..75eb70c17 100644 --- a/frontend/src/api/interface/database.ts +++ b/frontend/src/api/interface/database.ts @@ -33,6 +33,7 @@ export namespace Database { password: string; remoteConn: boolean; mysqlKey: string; + containerName: string; } export interface MysqlConfUpdateByFile { mysqlName: string; @@ -63,6 +64,13 @@ export namespace Database { thread_cache_size: number; thread_stack: number; tmp_table_size: number; + + slow_query_log: string; + long_query_time: number; + } + export interface VariablesUpdate { + param: string; + value: any; } export interface MysqlStatus { Aborted_clients: number; diff --git a/frontend/src/api/modules/database.ts b/frontend/src/api/modules/database.ts index 8cf3061d5..4fcf35a92 100644 --- a/frontend/src/api/modules/database.ts +++ b/frontend/src/api/modules/database.ts @@ -26,8 +26,8 @@ export const addMysqlDB = (params: Database.MysqlDBCreate) => { export const updateMysqlDBInfo = (params: Database.ChangeInfo) => { return http.put(`/databases/${params.id}`, params); }; -export const updateMysqlVariables = (params: Database.MysqlVariables) => { - return http.post(`/databases/variables/update`, params); +export const updateMysqlVariables = (mysqlName: string, params: Array) => { + return http.post(`/databases/variables/update/${mysqlName}`, params); }; export const updateMysqlConfByFile = (params: Database.MysqlConfUpdateByFile) => { return http.post(`/databases/conf/update/byfile`, params); diff --git a/frontend/src/components/confirm-dialog/index.vue b/frontend/src/components/confirm-dialog/index.vue new file mode 100644 index 000000000..716053535 --- /dev/null +++ b/frontend/src/components/confirm-dialog/index.vue @@ -0,0 +1,60 @@ + + + diff --git a/frontend/src/components/container-log/index.vue b/frontend/src/components/container-log/index.vue new file mode 100644 index 000000000..57abd676c --- /dev/null +++ b/frontend/src/components/container-log/index.vue @@ -0,0 +1,111 @@ + + + diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 8fe45b932..83bc30d37 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -70,6 +70,7 @@ export default { updateSuccess: '更新成功', uploadSuccess: '上传成功', operate: '操作', + operateConfirm: '如果确认操作,请手动输入', }, login: { captchaHelper: '请输入验证码', @@ -252,12 +253,13 @@ export default { hit: '查找数据库键命中率', latestForkUsec: '最近一次 fork() 操作耗费的微秒数', + recoverHelper: '即将使用 [{0}] 对数据进行覆盖,是否继续?', + submitIt: '覆盖数据', + baseConf: '基础配置', allConf: '全部配置', restartNow: '立即重启', - restartNowHelper1: '修改配置后需要', - restartNowHelper2: '重启 redis 生效', - restartNowHelper3: ',若您的数据需要持久化请先执行 save 操作。', + restartNowHelper1: '修改配置后需要重启生效,若您的数据需要持久化请先执行 save 操作。', persistence: '持久化', rdbHelper1: '秒內,插入', diff --git a/frontend/src/views/database/mysql/setting/index.vue b/frontend/src/views/database/mysql/setting/index.vue index 2b35e21b0..793c1bf95 100644 --- a/frontend/src/views/database/mysql/setting/index.vue +++ b/frontend/src/views/database/mysql/setting/index.vue @@ -1,5 +1,5 @@