Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeRequestBody(request *http.Request, v interface{}) error
- func GetMsg(c *gin.Context, code int) string
- func WrapMsg(c *gin.Context, retCode int, retMsg string, entity interface{})
- type AddNodeReq
- type AlterCkTableParams
- type AlterCkTableReq
- type ArchiveTableReq
- type CKManClickHouseConfig
- type CkClusterInfoRsp
- type CkClusterNode
- type CkColumnAttribute
- type CkDeployConfig
- type CkImportConfig
- type CkReplica
- type CkSessionInfo
- type CkShard
- type CkTableCost
- type CkTableMetrics
- type CkTableNameType
- type CkTableNameTypeAfter
- type CkTablePartition
- type CkUpgradeCk
- type CreateCkTableParams
- type CreateCkTableReq
- type DeleteCkTableParams
- type DeployCkReq
- type DescCkTableParams
- type LoginReq
- type LoginRsp
- type MetricQueryRangeReq
- type MetricQueryReq
- type PingClusterReq
- type PurgerTableReq
- type ResponseBody
- type SessionList
- type UpdateConfigReq
- type ZkReplicatedTableStatus
- type ZkReplicatedTableStatusRsp
- type ZkStatusRsp
Constants ¶
View Source
const ( CkTablePartitionPolicyDay int = iota CkTablePartitionPolicyWeek CkTablePartitionPolicyMonth ClickHouseDefaultEngine string = "MergeTree" ClickHouseDefaultReplicaEngine string = "ReplicatedMergeTree" ClickHouseReplacingEngine string = "ReplacingMergeTree" ClickHouseReplicaReplacingEngine string = "ReplicatedReplacingMergeTree" )
View Source
const ( SUCCESS = 0 INVALID_PARAMS = 5000 CREAT_CK_TABLE_FAIL = 5001 DELETE_CK_TABLE_FAIL = 5002 ALTER_CK_TABLE_FAIL = 5003 UPLOAD_LOCAL_PACKAGE_FAIL = 5004 UPLOAD_PEER_PACKAGE_FAIL = 5005 DELETE_LOCAL_PACKAGE_FAIL = 5006 DELETE_PEER_PACKAGE_FAIL = 5007 LIST_PACKAGE_FAIL = 5008 INIT_PACKAGE_FAIL = 5011 PREPARE_PACKAGE_FAIL = 5012 INSTALL_PACKAGE_FAIL = 5013 CONFIG_PACKAGE_FAIL = 5014 START_PACKAGE_FAIL = 5015 CHECK_PACKAGE_FAIL = 5016 JWT_TOKEN_EXPIRED = 5020 JWT_TOKEN_INVALID = 5021 JWT_TOKEN_NONE = 5022 JWT_TOKEN_IP_MISMATCH = 5023 USER_VERIFY_FAIL = 5030 GET_USER_PASSWORD_FAIL = 5031 PASSWORD_VERIFY_FAIL = 5032 CREAT_TOKEN_FAIL = 5033 DESC_CK_TABLE_FAIL = 5040 CONNECT_CK_CLUSTER_FAIL = 5041 IMPORT_CK_CLUSTER_FAIL = 5042 UPDATE_CK_CLUSTER_FAIL = 5043 QUERY_CK_FAIL = 5044 QUERY_METRIC_FAIL = 5050 QUERY_RANGE_METRIC_FAIL = 5051 UPGRADE_CK_CLUSTER_FAIL = 5060 START_CK_CLUSTER_FAIL = 5061 STOP_CK_CLUSTER_FAIL = 5062 DESTROY_CK_CLUSTER_FAIL = 5063 REBALANCE_CK_CLUSTER_FAIL = 5064 GET_CK_CLUSTER_INFO_FAIL = 5065 ADD_CK_CLUSTER_NODE_FAIL = 5066 DELETE_CK_CLUSTER_NODE_FAIL = 5067 GET_CK_TABLE_METRIC_FAIL = 5068 UPDATE_CONFIG_FAIL = 5070 GET_ZK_STATUS_FAIL = 5080 GET_ZK_TABLE_STATUS_FAIL = 5081 GET_CK_OPEN_SESSIONS_FAIL = 5090 GET_CK_SLOW_SESSIONS_FAIL = 5091 GET_NACOS_CONFIG_FAIL = 5100 PUB_NACOS_CONFIG_FAIL = 5101 DEPLOY_USER_RETAIN_ERROR = 5200 PING_CK_CLUSTER_FAIL = 5201 CLUSTER_NOT_EXIST = 5202 PURGER_TABLES_FAIL = 5203 ARCHIVE_TO_HDFS_FAIL = 5204 UNKNOWN = 99999 )
View Source
const ( CkClusterImport string = "import" CkClusterDeploy string = "deploy" CkClientPackagePrefix string = "clickhouse-client" CkClientPackageSuffix string = "2.noarch.rpm" CkCommonPackagePrefix string = "clickhouse-common-static" CkCommonPackageSuffix string = "2.x86_64.rpm" CkServerPackagePrefix string = "clickhouse-server" CkServerPackageSuffix string = "2.noarch.rpm" ClickHouseRetainUser string = "default" ClickHouseDefaultDB string = "default" ClickHouseDefaultUser string = "clickhouse" ClickHouseDefaultPassword string = "Ck123456!" ClickHouseDefaultPort int = 9000 ClickHouseDefaultHttpPort int = 8123 ClickHouseDefaultZkPort int = 2181 ZkStatusDefaultPort int = 8080 SshDefaultPort int = 22 )
View Source
const ( CkStatusGreen = "green" CkStatusYellow = "yellow" CkStatusRed = "red" )
Variables ¶
View Source
var MsgFlags_en = map[int]string{
SUCCESS: "ok",
INVALID_PARAMS: "invalid params",
CREAT_CK_TABLE_FAIL: "create ClickHouse table failed",
DELETE_CK_TABLE_FAIL: "delete ClickHouse table failed",
ALTER_CK_TABLE_FAIL: "alter ClickHouse table failed",
UPLOAD_LOCAL_PACKAGE_FAIL: "upload local package failed",
UPLOAD_PEER_PACKAGE_FAIL: "upload peer package failed",
DELETE_LOCAL_PACKAGE_FAIL: "delete local package failed",
DELETE_PEER_PACKAGE_FAIL: "delete peer package failed",
LIST_PACKAGE_FAIL: "get package list failed",
INIT_PACKAGE_FAIL: "init package failed",
PREPARE_PACKAGE_FAIL: "prepare package failed",
INSTALL_PACKAGE_FAIL: "install package failed",
CONFIG_PACKAGE_FAIL: "config package failed",
START_PACKAGE_FAIL: "start package fialed",
CHECK_PACKAGE_FAIL: "check package failed",
JWT_TOKEN_EXPIRED: "token has expired",
JWT_TOKEN_INVALID: "invalid token",
JWT_TOKEN_NONE: "request did not carry a token",
JWT_TOKEN_IP_MISMATCH: "Ip mismatched",
USER_VERIFY_FAIL: "user verify failed",
GET_USER_PASSWORD_FAIL: "get user and password failed",
PASSWORD_VERIFY_FAIL: "password verify failed",
CREAT_TOKEN_FAIL: "create token failed",
DESC_CK_TABLE_FAIL: "describe ClickHouse table failed",
QUERY_METRIC_FAIL: "get query metric failed",
QUERY_RANGE_METRIC_FAIL: "get range-metric failed",
QUERY_CK_FAIL: "query ClickHouse failed",
CONNECT_CK_CLUSTER_FAIL: "connect ClickHouse cluster failed",
IMPORT_CK_CLUSTER_FAIL: "import ClickHouse cluster failed",
UPDATE_CK_CLUSTER_FAIL: "update ClickHouse cluster failed",
UPGRADE_CK_CLUSTER_FAIL: "upgrade ClickHouse cluster failed",
START_CK_CLUSTER_FAIL: "start ClickHouse cluster failed",
STOP_CK_CLUSTER_FAIL: "stop ClickHouse cluster failed",
DESTROY_CK_CLUSTER_FAIL: "destroy ClickHouse cluster failed",
REBALANCE_CK_CLUSTER_FAIL: "rebalance ClickHouse cluster failed",
GET_CK_CLUSTER_INFO_FAIL: "get ClickHouse cluster information failed",
ADD_CK_CLUSTER_NODE_FAIL: "add ClickHouse node failed",
DELETE_CK_CLUSTER_NODE_FAIL: "delete ClickHouse node failed",
GET_CK_TABLE_METRIC_FAIL: "get metric of ClickHouse table failed",
UPDATE_CONFIG_FAIL: "update config failed",
GET_ZK_STATUS_FAIL: "get Zookeeper status failed",
GET_ZK_TABLE_STATUS_FAIL: "get Zookeeper table status failed",
GET_CK_OPEN_SESSIONS_FAIL: "get open sessions failed",
GET_CK_SLOW_SESSIONS_FAIL: "get slow sessions failed",
GET_NACOS_CONFIG_FAIL: "get nacos config failed",
PUB_NACOS_CONFIG_FAIL: "publish nacos config failed",
DEPLOY_USER_RETAIN_ERROR: "ClickHouse user cannot be default when deploy cluster",
PING_CK_CLUSTER_FAIL: "ClickHouse cluster can't ping all nodes successfully",
CLUSTER_NOT_EXIST: "Cluster does not exist",
PURGER_TABLES_FAIL: "purger tables range failed",
ARCHIVE_TO_HDFS_FAIL: "archive to hdfs failed",
UNKNOWN: "unknown",
}
View Source
var MsgFlags_zh = map[int]string{
SUCCESS: "ok",
INVALID_PARAMS: "请求参数错误",
CREAT_CK_TABLE_FAIL: "创建ClickHouse表失败",
DELETE_CK_TABLE_FAIL: "删除ClickHouse表失败",
ALTER_CK_TABLE_FAIL: "更改ClickHouse表失败",
UPLOAD_LOCAL_PACKAGE_FAIL: "上传安装包到本地失败",
UPLOAD_PEER_PACKAGE_FAIL: "上传安装包到邻近节点失败",
DELETE_LOCAL_PACKAGE_FAIL: "删除本地安装包失败",
DELETE_PEER_PACKAGE_FAIL: "删除邻近节点安装包失败",
LIST_PACKAGE_FAIL: "获取安装包列表失败",
INIT_PACKAGE_FAIL: "初始化组件失败",
PREPARE_PACKAGE_FAIL: "准备组件失败",
INSTALL_PACKAGE_FAIL: "安装组件失败",
CONFIG_PACKAGE_FAIL: "配置组件失败",
START_PACKAGE_FAIL: "启动组件失败",
CHECK_PACKAGE_FAIL: "检查组件启动状态失败",
JWT_TOKEN_EXPIRED: "token已过期",
JWT_TOKEN_INVALID: "无效的token",
JWT_TOKEN_NONE: "请求未携带token",
JWT_TOKEN_IP_MISMATCH: "Ip不匹配",
USER_VERIFY_FAIL: "该用户不存在",
GET_USER_PASSWORD_FAIL: "获取用户密码失败",
PASSWORD_VERIFY_FAIL: "用户密码验证失败",
CREAT_TOKEN_FAIL: "生成token失败",
DESC_CK_TABLE_FAIL: "描述ClickHouse表失败",
QUERY_METRIC_FAIL: "获取指标失败",
QUERY_RANGE_METRIC_FAIL: "获取指标范围失败",
QUERY_CK_FAIL: "查询ClickHouse失败",
CONNECT_CK_CLUSTER_FAIL: "连接ClickHouse集群失败",
IMPORT_CK_CLUSTER_FAIL: "导入ClickHouse集群失败",
UPDATE_CK_CLUSTER_FAIL: "更新ClickHouse集群失败",
UPGRADE_CK_CLUSTER_FAIL: "升级ClickHouse集群失败",
START_CK_CLUSTER_FAIL: "启动ClickHouse服务失败",
STOP_CK_CLUSTER_FAIL: "停止ClickHouse集群失败",
DESTROY_CK_CLUSTER_FAIL: "销毁ClickHouse集群失败",
REBALANCE_CK_CLUSTER_FAIL: "均衡ClickHouse集群失败",
GET_CK_CLUSTER_INFO_FAIL: "获取ClickHouse集群信息失败",
ADD_CK_CLUSTER_NODE_FAIL: "添加ClickHouse集群节点失败",
DELETE_CK_CLUSTER_NODE_FAIL: "删除ClickHouse集群节点失败",
GET_CK_TABLE_METRIC_FAIL: "获取ClickHouse表的指标失败",
UPDATE_CONFIG_FAIL: "更新配置失败",
GET_ZK_STATUS_FAIL: "获取Zookeeper状态失败",
GET_ZK_TABLE_STATUS_FAIL: "获取复制表状态失败",
GET_CK_OPEN_SESSIONS_FAIL: "获取ClickHouse进行中的查询失败",
GET_CK_SLOW_SESSIONS_FAIL: "获取ClickHouse慢查询失败",
GET_NACOS_CONFIG_FAIL: "获取Nacos配置失败",
PUB_NACOS_CONFIG_FAIL: "上传Nacos配置失败",
DEPLOY_USER_RETAIN_ERROR: "部署集群时ClickHouse用户不能为default",
PING_CK_CLUSTER_FAIL: "ClickHouse集群节点无法连接",
CLUSTER_NOT_EXIST: "集群不存在",
PURGER_TABLES_FAIL: "删除指定时间范围内数据失败",
ARCHIVE_TO_HDFS_FAIL: "归档到HDFS失败",
UNKNOWN: "unknown",
}
Functions ¶
func DecodeRequestBody ¶
Types ¶
type AddNodeReq ¶
type AlterCkTableParams ¶
type AlterCkTableParams struct { Name string Cluster string DB string Add []CkTableNameTypeAfter Drop []string Modify []CkTableNameType }
type AlterCkTableReq ¶
type AlterCkTableReq struct { Name string `json:"name" example:"test_table"` DB string `json:"database" example:"default"` Add []CkTableNameTypeAfter `json:"add"` Modify []CkTableNameType `json:"modify"` Drop []string `json:"drop" example:"age"` }
type ArchiveTableReq ¶ added in v1.2.8
type ArchiveTableReq struct { Database string `json:"database" example:"default"` Tables []string `json:"tables" example:"t1,t2,t3"` Begin string `json:"begin" example:"2021-01-01"` End string `json:"end" example:"2021-04-01"` MaxFileSize int `json:"maxfilesize" example:"10000000000"` HdfsAddr string `json:"hdfsaddr" example:"localhost:8020"` HdfsUser string `json:"hdfsuser" example:"hdfs"` HdfsDir string `json:"hdfsdir" example:"/data01"` Parallelism int `json:"parallelism" example:"4"` }
type CKManClickHouseConfig ¶
type CKManClickHouseConfig struct { Mode string `json:"mode"` Hosts []string `json:"hosts"` Port int `json:"port"` HttpPort int `json:"httpPort"` User string `json:"user"` Password string `json:"password"` Cluster string `json:"cluster"` ZkNodes []string `json:"zkNodes"` ZkPort int `json:"zkPort"` ZkStatusPort int `json:"zkStatusPort"` IsReplica bool `json:"isReplica"` Version string `json:"version"` SshUser string `json:"sshUser"` SshPassword string `json:"sshPassword"` SshPort int `json:"sshPort"` Shards []CkShard `json:"shards"` Path string `json:"path"` ZooPath map[string]string `json:"zooPath"` }
func (*CKManClickHouseConfig) Normalize ¶ added in v1.3.0
func (config *CKManClickHouseConfig) Normalize()
type CkClusterInfoRsp ¶
type CkClusterInfoRsp struct { Status string `json:"status"` Version string `json:"version"` Nodes []CkClusterNode `json:"nodes"` Mode string `json:"mode"` }
type CkClusterNode ¶
type CkColumnAttribute ¶ added in v1.2.8
type CkColumnAttribute struct { Name string `json:"name"` Type string `json:"type"` DefaultType string `json:"defaultType"` DefaultExpression string `json:"defaultExpression"` Comment string `json:"comment"` CodecExpression string `json:"codecExpression"` TTLExpression string `json:"ttlExpression"` }
type CkDeployConfig ¶
type CkDeployConfig struct { Path string `json:"path" example:"/data01/"` User string `json:"user" example:"ck"` Password string `json:"password" example:"123456"` ZkNodes []string `json:"zkNodes" example:"192.168.101.102,192.168.101.105,192.168.101.107"` ZkPort int `json:"zkPort" example:"2181"` ZkStatusPort int `json:"zkStatusPort" example:"8080"` ClusterName string `json:"clusterName" example:"test"` Shards []CkShard `json:"shards"` PackageVersion string `json:"packageVersion" example:"20.8.5.45"` CkTcpPort int `json:"ckTcpPort" example:"9000"` CkHttpPort int `json:"ckHttpPort" example:"8123"` IsReplica bool `json:"isReplica"` }
func (*CkDeployConfig) Normalize ¶ added in v1.3.0
func (config *CkDeployConfig) Normalize()
type CkImportConfig ¶
type CkImportConfig struct { Hosts []string `json:"hosts" example:"192.168.101.105,192.168.101.107"` Port int `json:"port" example:"9000"` HttpPort int `json:"httpPort" example:"8123"` User string `json:"user" example:"ck"` Password string `json:"password" example:"123456"` Cluster string `json:"cluster" example:"test"` ZkNodes []string `json:"zkNodes" example:"192.168.101.102,192.168.101.105,192.168.101.107"` ZkPort int `json:"zkPort" example:"2181"` ZkStatusPort int `json:"zkStatusPort" example:"8080"` }
type CkSessionInfo ¶
type CkTableCost ¶
type CkTableMetrics ¶
type CkTableMetrics struct { Columns uint64 `json:"columns"` Rows uint64 `json:"rows"` Parts uint64 `json:"parts"` DiskSpace uint64 `json:"-"` Space string `json:"space"` CompletedQueries uint64 `json:"completedQueries"` FailedQueries uint64 `json:"failedQueries"` QueryCost CkTableCost `json:"queryCost"` }
type CkTableNameType ¶
type CkTableNameTypeAfter ¶
type CkTablePartition ¶
type CkUpgradeCk ¶ added in v1.2.6
type CkUpgradeCk struct {
PackageVersion string `json:"packageVersion"`
}
type CreateCkTableParams ¶
type CreateCkTableParams struct { Name string Cluster string Engine string Fields []CkTableNameType Order []string Partition CkTablePartition DB string }
type CreateCkTableReq ¶
type CreateCkTableReq struct { Name string `json:"name" example:"test_table"` DB string `json:"database" example:"default"` Fields []CkTableNameType `json:"fields"` Order []string `json:"order" example:"_timestamp"` Partition CkTablePartition `json:"partition"` Distinct bool `json:"distinct" example:"true"` }
type DeleteCkTableParams ¶
type DeployCkReq ¶
type DeployCkReq struct { Hosts []string `json:"hosts" example:"192.168.101.105"` User string `json:"user" example:"root"` Password string `json:"password" example:"123456"` Port int `json:"sshPort" example:"22"` ClickHouse CkDeployConfig `json:"clickhouse"` }
type DescCkTableParams ¶
type MetricQueryRangeReq ¶
type MetricQueryReq ¶
type PingClusterReq ¶ added in v1.2.8
type PurgerTableReq ¶ added in v1.2.8
type ResponseBody ¶
type SessionList ¶
type SessionList []*CkSessionInfo
func (SessionList) Len ¶
func (l SessionList) Len() int
func (SessionList) Less ¶
func (l SessionList) Less(i, j int) bool
func (SessionList) Swap ¶
func (l SessionList) Swap(i, j int)
type UpdateConfigReq ¶
type ZkReplicatedTableStatus ¶
type ZkReplicatedTableStatusRsp ¶
type ZkReplicatedTableStatusRsp struct { Header [][]string `json:"header"` Tables []ZkReplicatedTableStatus `json:"tables"` }
type ZkStatusRsp ¶
type ZkStatusRsp struct { Host string `json:"host"` Version string `json:"version"` ServerState string `json:"server_state"` PeerState string `json:"peer_state"` AvgLatency float64 `json:"avg_latency"` ApproximateDataSize float64 `json:"approximate_data_size"` ZnodeCount float64 `json:"znode_count"` }
Click to show internal directories.
Click to hide internal directories.