github.com/pingcap/tiup@v1.15.1/components/playground/instance/tiflash_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 "path/filepath"
    17  
    18  func (inst *TiFlashInstance) getProxyConfig() map[string]any {
    19  	config := make(map[string]any)
    20  	config["rocksdb.max-open-files"] = 256
    21  	config["raftdb.max-open-files"] = 256
    22  	config["storage.reserve-space"] = 0
    23  	config["storage.reserve-raft-space"] = 0
    24  
    25  	if inst.Role == TiFlashRoleDisaggWrite {
    26  		config["storage.api-version"] = 2
    27  		config["storage.enable-ttl"] = true
    28  		config["dfs.prefix"] = "tikv"
    29  		config["dfs.s3-endpoint"] = inst.cseOpts.S3Endpoint
    30  		config["dfs.s3-key-id"] = inst.cseOpts.AccessKey
    31  		config["dfs.s3-secret-key"] = inst.cseOpts.SecretKey
    32  		config["dfs.s3-bucket"] = inst.cseOpts.Bucket
    33  		config["dfs.s3-region"] = "local"
    34  	}
    35  
    36  	return config
    37  }
    38  
    39  func (inst *TiFlashInstance) getConfig() map[string]any {
    40  	config := make(map[string]any)
    41  
    42  	config["flash.proxy.config"] = filepath.Join(inst.Dir, "tiflash_proxy.toml")
    43  	config["logger.level"] = "debug"
    44  
    45  	if inst.Role == TiFlashRoleDisaggWrite {
    46  		config["enable_safe_point_v2"] = true
    47  		config["storage.api_version"] = 2
    48  		config["storage.s3.endpoint"] = inst.cseOpts.S3Endpoint
    49  		config["storage.s3.bucket"] = inst.cseOpts.Bucket
    50  		config["storage.s3.root"] = "/tiflash-cse/"
    51  		config["storage.s3.access_key_id"] = inst.cseOpts.AccessKey
    52  		config["storage.s3.secret_access_key"] = inst.cseOpts.SecretKey
    53  		config["storage.main.dir"] = []string{filepath.Join(inst.Dir, "main_data")}
    54  		config["flash.disaggregated_mode"] = "tiflash_write"
    55  	} else if inst.Role == TiFlashRoleDisaggCompute {
    56  		config["enable_safe_point_v2"] = true
    57  		config["storage.s3.endpoint"] = inst.cseOpts.S3Endpoint
    58  		config["storage.s3.bucket"] = inst.cseOpts.Bucket
    59  		config["storage.s3.root"] = "/tiflash-cse/"
    60  		config["storage.s3.access_key_id"] = inst.cseOpts.AccessKey
    61  		config["storage.s3.secret_access_key"] = inst.cseOpts.SecretKey
    62  		config["storage.remote.cache.dir"] = filepath.Join(inst.Dir, "remote_cache")
    63  		config["storage.remote.cache.capacity"] = 20000000000 // 20GB
    64  		config["storage.main.dir"] = []string{filepath.Join(inst.Dir, "main_data")}
    65  		config["flash.disaggregated_mode"] = "tiflash_compute"
    66  	}
    67  
    68  	return config
    69  }