最核心的一部分数据结构,即集群相关组件信息的存储。
clusters
集群表
CREATE TABLE clusters (
cluster_id BIGINT NOT NULL,
resource_id BIGINT NOT NULL,
upgrade_id BIGINT,
cluster_info VARCHAR(255) NOT NULL,
cluster_name VARCHAR(100) NOT NULL UNIQUE,
provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT',
security_type VARCHAR(32) NOT NULL DEFAULT 'NONE',
desired_cluster_state VARCHAR(255) NOT NULL,
desired_stack_id BIGINT NOT NULL,
CONSTRAINT PK_clusters PRIMARY KEY (cluster_id),
CONSTRAINT FK_clusters_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES stack(stack_id),
CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES adminresource(resource_id));
重点说明
- provisioning_state 集群状态字段,表示集群初始化中或者已经部署完成(whether the cluster is still initializing or has finished with its deployment requests.)
- security_type 安全状态,目前只支持kerbose
- desired_cluster_state 该字段貌似目前没有用到
clusterservices
集群服务表
CREATE TABLE clusterservices (
service_name VARCHAR(255) NOT NULL,
cluster_id BIGINT NOT NULL,
service_enabled INTEGER NOT NULL,
CONSTRAINT PK_clusterservices PRIMARY KEY (service_name, cluster_id),
CONSTRAINT FK_clusterservices_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id));
servicedesiredstate
CREATE TABLE servicedesiredstate (
cluster_id BIGINT NOT NULL,
desired_host_role_mapping INTEGER NOT NULL,
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
credential_store_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY (cluster_id, service_name),
CONSTRAINT FK_sds_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES stack(stack_id),
CONSTRAINT servicedesiredstateservicename FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id));
服务理想状态表,判断用来持续跟踪服务状态的落地表。
2 0 2 STARTED AMBARI_INFRA OFF UNSECURED
2 0 2 STARTED AMBARI_METRICS OFF UNSECURED
2 0 2 STARTED FLUME OFF UNSECURED
2 0 2 STARTED HBASE OFF UNSECURED
2 0 2 STARTED HDFS OFF UNSECURED
2 0 2 STARTED HIVE OFF UNSECURED
2 0 2 STARTED KAFKA OFF UNSECURED
2 0 2 STARTED LOGSEARCH OFF UNSECURED
2 0 2 STARTED MAPREDUCE2 OFF UNSECURED
2 0 2 INSTALLED PIG OFF UNSECURED
2 0 2 INSTALLED SLIDER OFF UNSECURED
2 0 2 STARTED SMARTSENSE OFF UNSECURED
2 0 2 INSTALLED TEZ OFF UNSECURED
2 0 2 STARTED YARN OFF UNSECURED
2 0 2 STARTED ZOOKEEPER OFF UNSECURED
servicecomponentdesiredstate
CREATE TABLE servicecomponentdesiredstate (
id BIGINT NOT NULL,
component_name VARCHAR(100) NOT NULL,
cluster_id BIGINT NOT NULL,
desired_stack_id BIGINT NOT NULL,
desired_version VARCHAR(255) NOT NULL DEFAULT 'UNKNOWN',
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(100) NOT NULL,
recovery_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT UQ_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id),
CONSTRAINT FK_scds_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES stack(stack_id),
CONSTRAINT srvccmponentdesiredstatesrvcnm FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id));
服务组件理想数据表。
1 JOURNALNODE 2 2 UNKNOWN STARTED HDFS 0
2 SECONDARY_NAMENODE 2 2 2.5.3.0-37 STARTED HDFS 0
3 ZKFC 2 2 UNKNOWN STARTED HDFS 0
4 NFS_GATEWAY 2 2 2.5.3.0-37 STARTED HDFS 0
5 DATANODE 2 2 2.5.3.0-37 STARTED HDFS 0
6 HDFS_CLIENT 2 2 2.5.3.0-37 INSTALLED HDFS 0
7 NAMENODE 2 2 2.5.3.0-37 STARTED HDFS 0
8 APP_TIMELINE_SERVER 2 2 2.5.3.0-37 STARTED YARN 0
9 YARN_CLIENT 2 2 2.5.3.0-37 INSTALLED YARN 0
10 RESOURCEMANAGER 2 2 2.5.3.0-37 STARTED YARN 0
11 NODEMANAGER 2 2 2.5.3.0-37 STARTED YARN 0
12 MAPREDUCE2_CLIENT 2 2 2.5.3.0-37 INSTALLED MAPREDUCE2 0
13 HISTORYSERVER 2 2 2.5.3.0-37 STARTED MAPREDUCE2 0
14 TEZ_CLIENT 2 2 2.5.3.0-37 INSTALLED TEZ 0
15 WEBHCAT_SERVER 2 2 2.5.3.0-37 STARTED HIVE 0
16 HIVE_SERVER_INTERACTIVE 2 2 UNKNOWN STARTED HIVE 0
17 MYSQL_SERVER 2 2 UNKNOWN STARTED HIVE 0
18 HIVE_METASTORE 2 2 2.5.3.0-37 STARTED HIVE 0
19 HCAT 2 2 2.5.3.0-37 INSTALLED HIVE 0
20 HIVE_SERVER 2 2 2.5.3.0-37 STARTED HIVE 0
21 HIVE_CLIENT 2 2 2.5.3.0-37 INSTALLED HIVE 0
22 HBASE_MASTER 2 2 2.5.3.0-37 STARTED HBASE 0
23 HBASE_REGIONSERVER 2 2 2.5.3.0-37 STARTED HBASE 0
24 HBASE_CLIENT 2 2 2.5.3.0-37 INSTALLED HBASE 0
25 PHOENIX_QUERY_SERVER 2 2 2.5.3.0-37 STARTED HBASE 0
26 PIG 2 2 2.5.3.0-37 INSTALLED PIG 0
27 ZOOKEEPER_CLIENT 2 2 2.5.3.0-37 INSTALLED ZOOKEEPER 0
28 ZOOKEEPER_SERVER 2 2 2.5.3.0-37 STARTED ZOOKEEPER 0
29 FLUME_HANDLER 2 2 2.5.3.0-37 STARTED FLUME 0
30 INFRA_SOLR 2 2 UNKNOWN STARTED AMBARI_INFRA 0
31 INFRA_SOLR_CLIENT 2 2 UNKNOWN INSTALLED AMBARI_INFRA 0
32 METRICS_COLLECTOR 2 2 UNKNOWN STARTED AMBARI_METRICS 1
33 METRICS_GRAFANA 2 2 UNKNOWN STARTED AMBARI_METRICS 0
34 METRICS_MONITOR 2 2 UNKNOWN STARTED AMBARI_METRICS 0
35 KAFKA_BROKER 2 2 2.5.3.0-37 STARTED KAFKA 0
36 LOGSEARCH_SERVER 2 2 UNKNOWN STARTED LOGSEARCH 0
37 LOGSEARCH_LOGFEEDER 2 2 UNKNOWN STARTED LOGSEARCH 0
38 HST_SERVER 2 2 UNKNOWN STARTED SMARTSENSE 0
39 ACTIVITY_ANALYZER 2 2 UNKNOWN STARTED SMARTSENSE 0
40 ACTIVITY_EXPLORER 2 2 UNKNOWN STARTED SMARTSENSE 0
41 HST_AGENT 2 2 UNKNOWN STARTED SMARTSENSE 0
42 SLIDER 2 2 2.5.3.0-37 INSTALLED SLIDER 0
hostcomponentdesiredstate
主机组件理想状态
CREATE TABLE hostcomponentdesiredstate (
id BIGINT NOT NULL,
cluster_id BIGINT NOT NULL,
component_name VARCHAR(100) NOT NULL,
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
host_id BIGINT NOT NULL,
service_name VARCHAR(100) NOT NULL,
admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
restart_required TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id),
CONSTRAINT FK_hcdesiredstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT FK_hcds_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES stack(stack_id),
CONSTRAINT hstcmpnntdesiredstatecmpnntnme FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
2 DATANODE 2 STARTED 3 HDFS INSERVICE OFF UNSECURED 0
2 HBASE_MASTER 2 STARTED 1 HBASE OFF UNSECURED 0
2 HBASE_CLIENT 2 INSTALLED 1 HBASE OFF UNSECURED 0
hostcomponentstate
主机组件状态
CREATE TABLE hostcomponentstate (
id BIGINT NOT NULL,
cluster_id BIGINT NOT NULL,
component_name VARCHAR(100) NOT NULL,
version VARCHAR(32) NOT NULL DEFAULT 'UNKNOWN',
current_stack_id BIGINT NOT NULL,
current_state VARCHAR(255) NOT NULL,
host_id BIGINT NOT NULL,
service_name VARCHAR(100) NOT NULL,
upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id),
CONSTRAINT FK_hcs_current_stack_id FOREIGN KEY (current_stack_id) REFERENCES stack(stack_id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
1 2 NAMENODE 2.5.3.0-37 2 INSTALLED 1 HDFS NONE UNSECURED
6 2 HIVE_SERVER 2.5.3.0-37 2 INSTALLED 2 HIVE NONE UNSECURED
9 2 HBASE_MASTER 2.5.3.0-37 2 INSTALLED 1 HBASE NONE UNSECURED
未完待续