github.com/pingcap/tiup@v1.15.1/components/playground/instance/tidb_config.go (about)

     1  // Copyright 2023 PingCAP, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package instance
    15  
    16  import (
    17  	"os"
    18  	"path/filepath"
    19  )
    20  
    21  func (inst *TiDBInstance) getConfig() map[string]any {
    22  	config := make(map[string]any)
    23  	config["security.auto-tls"] = true
    24  
    25  	if inst.isCSEMode {
    26  		config["keyspace-name"] = "mykeyspace"
    27  		config["enable-safe-point-v2"] = true
    28  		config["force-enable-vector-type"] = true
    29  		config["use-autoscaler"] = false
    30  		config["disaggregated-tiflash"] = true
    31  		config["ratelimit.full-speed"] = 1048576000
    32  		config["ratelimit.full-speed-capacity"] = 1048576000
    33  		config["ratelimit.low-speed-watermark"] = 1048576000000
    34  		config["ratelimit.block-write-watermark"] = 1048576000000
    35  		config["security.enable-sem"] = false
    36  		config["tiflash-replicas.constraints"] = []any{
    37  			map[string]any{
    38  				"key": "engine",
    39  				"op":  "in",
    40  				"values": []string{
    41  					"tiflash",
    42  				},
    43  			},
    44  			map[string]any{
    45  				"key": "engine_role",
    46  				"op":  "in",
    47  				"values": []string{
    48  					"write",
    49  				},
    50  			},
    51  		}
    52  		config["tiflash-replicas.group-id"] = "enable_s3_wn_region"
    53  		config["tiflash-replicas.extra-s3-rule"] = false
    54  		config["tiflash-replicas.min-count"] = 1
    55  	}
    56  
    57  	tiproxyCrtPath := filepath.Join(inst.tiproxyCertDir, "tiproxy.crt")
    58  	tiproxyKeyPath := filepath.Join(inst.tiproxyCertDir, "tiproxy.key")
    59  	_, err1 := os.Stat(tiproxyCrtPath)
    60  	_, err2 := os.Stat(tiproxyKeyPath)
    61  	if err1 == nil && err2 == nil {
    62  		config["security.session-token-signing-cert"] = tiproxyCrtPath
    63  		config["security.session-token-signing-key"] = tiproxyKeyPath
    64  	}
    65  
    66  	return config
    67  }