Documentation ¶
Index ¶
- Constants
- Variables
- func DownloadPackage(destDir string, entry PackageEntry) (string, error)
- func InitNodes(rpmPackagePaths []string, forceClean bool, configs ...NodeConfig) error
- func InstallObshell(rpmPackagePath string, configs ...NodeConfig) error
- func NewBaseMirror(name, baseUrl string) *baseMirror
- func SearchPackage(entry PackageEntry) ([]packageInfo, error)
- func StartObshell(configs ...NodeConfig) error
- func Takeover(password string, configs ...NodeConfig) error
- type Location
- type Mirror
- type NodeClient
- type NodeConfig
- type PackageEntry
- type SSHConfig
- type SshRetun
Constants ¶
const ( REMOTE_REPOMD_FILE = "/repodata/repomd.xml" REPO_AGE_FILE = ".rege_age" PRIMARY_REPOMD_TYPE = "primary" )
const ( X86_64 = "x86_64" AARCH64 = "aarch64" NONLSE = "nonlse" EL7 = "7" EL8 = "8" )
const ( DEFALUT_SSH_PORT = 22 DEFALUT_OBSHELL_PORT = 2886 DEFALUT_SSH_PATH = ".ssh" )
const FLAG_ROOT_PWD = "password"
Variables ¶
var ( // Base mirrors OB_COMMUNITY_STABLE_BASE = NewBaseMirror("OceanBase-community-stable-el$releasever", "https://mirrors.oceanbase.com/oceanbase/community/stable/el/$releasever/$basearch/") OB_DEVELOPMENT_KIT_BASE = NewBaseMirror("OceanBase-development-kit-el$releasever", "https://mirrors.oceanbase.com/oceanbase/development-kit/el/$releasever/$basearch/") // Mirrors OB_COMMUNITY_STABLE_MIRROR Mirror OB_DEVELOPMENT_KIT_MIRROR Mirror OB_MIRRORS []Mirror )
var ( // Unlike the Python SDK, the Go SDK does not use rsync by default, but instead uses sftp for chunked transfer. // This is because the rsync implementation in the GO SDK is not fully developed and can only be used with default key configuration for passwordless login. // At the same time, the performance of the sftp chunked transfer in the GO SDK is comparable to rsync. UseRsync = false // The size of each sftp chunked transfer, default is 64M. // Since the maximum size of a single file in the current OB, observer, is around 450M, with 64M, it can be divided into 7-8 chunks. // This would require 7-8 concurrent connections, and since the default MaxSessions in the sshd configuration is 10, this value is appropriate. // If you want to improve the performance of sftp chunked transfer, you can reduce this value to increase the number of concurrent connections. // However, you will need to correspondingly increase the MaxSessions configuration on the target machine. CHUNK_SIZE = 1024 * 1024 * 64 // The maximum number of parallel SFTP transfers to avoid exceeding the MaxSessions limit PARALLEL_SFTP_MAX = 8 // Since using in-memory backup for small files results in higher batch transfer efficiency, only files larger than SCP_THRESHOLD will be transferred using SCP. // You can disable SCP by setting SCP_THRESHOLD=0. SCP_THRESHOLD int64 = 1024 * 1024 * 1 )
Functions ¶
func DownloadPackage ¶
func DownloadPackage(destDir string, entry PackageEntry) (string, error)
DownloadPackage searches for the specified package entry across all mirrors defined in OB_MIRRORS and downloads the first match to the destination directory. If no matching package is found in any mirror, or an error occurs, it returns an error.
func InitNodes ¶
func InitNodes(rpmPackagePaths []string, forceClean bool, configs ...NodeConfig) error
func InstallObshell ¶
func InstallObshell(rpmPackagePath string, configs ...NodeConfig) error
将Obshell安装到指定的服务器上, 自会将obshell RPM包
func NewBaseMirror ¶
func NewBaseMirror(name, baseUrl string) *baseMirror
func SearchPackage ¶
func SearchPackage(entry PackageEntry) ([]packageInfo, error)
SearchPackage searches for packages that match the provided package entry across all mirrors defined in OB_MIRRORS. If no matching packages are found, or an error occurs during the search, it returns an error.
func StartObshell ¶
func StartObshell(configs ...NodeConfig) error
func Takeover ¶
func Takeover(password string, configs ...NodeConfig) error
Types ¶
type Mirror ¶
type Mirror struct {
// contains filtered or unexported fields
}
func (Mirror) Download ¶
func (m Mirror) Download(destDir string, entry PackageEntry) (string, error)
Download searches for the specified package entry in the mirror and downloads the first match to the destination directory. If no matching package is found, or an error occurs during the search, it returns an error.
func (Mirror) Search ¶
func (m Mirror) Search(entry PackageEntry) ([]packageInfo, error)
Search looks for packages that match the provided package entry within the mirror. If no matching packages are found or an error occurs during the search, it returns an error.
type NodeClient ¶
type NodeClient struct { *ssh.Client NodeConfig // contains filtered or unexported fields }
func NewNodeClient ¶
func NewNodeClient(config NodeConfig) (*NodeClient, error)
func (*NodeClient) ExecuteCommand ¶
func (client *NodeClient) ExecuteCommand(cmd string) SshRetun
type NodeConfig ¶
type NodeConfig struct { SSHConfig // contains filtered or unexported fields }
func NewNodeConfig ¶
func NewNodeConfig(ip string, workDir string, obshellPort ...int) NodeConfig
func NewNodeConfigWithSShConfig ¶
func NewNodeConfigWithSShConfig(ip string, workDir string, config SSHConfig, obshellPort ...int) NodeConfig
type PackageEntry ¶
type SSHConfig ¶
type SSHConfig struct { *ssh.ClientConfig // contains filtered or unexported fields }
func NewSSHConfig ¶
func NewSSHConfig(config ssh.ClientConfig, sshPort ...int) SSHConfig