如何导出Ambari中的配置表

本文安装Ambari采用的都是默认配置

  1. root用户在安装Ambari服务的机器执行psql ambari -U ambari -W -p 5432,这时会提示Password for user ambari:,输入默认的秘密为bigdata
  2. 执行\dt列出ambari这个数据库的所有表
ambari=> \dt
                    List of relations
 Schema |             Name              | Type  | Owner  
--------+-------------------------------+-------+--------
 ambari | adminpermission               | table | ambari
 ambari | adminprincipal                | table | ambari
 ambari | adminprincipaltype            | table | ambari
 ambari | adminprivilege                | table | ambari
 ambari | adminresource                 | table | ambari
 ambari | adminresourcetype             | table | ambari
 ambari | alert_current                 | table | ambari
 ambari | alert_definition              | table | ambari
 ambari | alert_group                   | table | ambari
 ambari | alert_group_target            | table | ambari
 ambari | alert_grouping                | table | ambari
 ambari | alert_history                 | table | ambari
 ambari | alert_notice                  | table | ambari
 ambari | alert_target                  | table | ambari
 ambari | alert_target_states           | table | ambari
 ambari | ambari_operation_history      | table | ambari
 ambari | ambari_sequences              | table | ambari
 ambari | artifact                      | table | ambari
 ambari | blueprint                     | table | ambari
 ambari | blueprint_configuration       | table | ambari
 ambari | blueprint_setting             | table | ambari
 ambari | cluster_version               | table | ambari
 ambari | clusterconfig                 | table | ambari
 ambari | clusterconfigmapping          | table | ambari
 ambari | clusterhostmapping            | table | ambari
 ambari | clusters                      | table | ambari
 ambari | clusterservices               | table | ambari
 ambari | clusterstate                  | table | ambari
 ambari | confgroupclusterconfigmapping | table | ambari
 ambari | configgroup                   | table | ambari
 ambari | configgrouphostmapping        | table | ambari
 ambari | execution_command             | table | ambari
 ambari | extension                     | table | ambari
 ambari | extensionlink                 | table | ambari
 ambari | groups                        | table | ambari
 ambari | host_role_command             | table | ambari
 ambari | host_version                  | table | ambari
 ambari | hostcomponentdesiredstate     | table | ambari
 ambari | hostcomponentstate            | table | ambari
 ambari | hostconfigmapping             | table | ambari
 ambari | hostgroup                     | table | ambari
 ambari | hostgroup_component           | table | ambari
 ambari | hostgroup_configuration       | table | ambari
 ambari | hosts                         | table | ambari
 ambari | hoststate                     | table | ambari
 ambari | kerberos_descriptor           | table | ambari
 ambari | kerberos_principal            | table | ambari
 ambari | kerberos_principal_host       | table | ambari
 ambari | key_value_store               | table | ambari
 ambari | members                       | table | ambari
 ambari | metainfo                      | table | ambari
 ambari | permission_roleauthorization  | table | ambari
 ambari | qrtz_blob_triggers            | table | ambari
 ambari | qrtz_calendars                | table | ambari
 ambari | qrtz_cron_triggers            | table | ambari
 ambari | qrtz_fired_triggers           | table | ambari
 ambari | qrtz_job_details              | table | ambari
 ambari | qrtz_locks                    | table | ambari
 ambari | qrtz_paused_trigger_grps      | table | ambari
 ambari | qrtz_scheduler_state          | table | ambari
 ambari | qrtz_simple_triggers          | table | ambari
 ambari | qrtz_simprop_triggers         | table | ambari
 ambari | qrtz_triggers                 | table | ambari
 ambari | remoteambaricluster           | table | ambari
 ambari | remoteambariclusterservice    | table | ambari
 ambari | repo_version                  | table | ambari
 ambari | request                       | table | ambari
 ambari | requestoperationlevel         | table | ambari
 ambari | requestresourcefilter         | table | ambari
 ambari | requestschedule               | table | ambari
 ambari | requestschedulebatchrequest   | table | ambari
 ambari | role_success_criteria         | table | ambari
 ambari | roleauthorization             | table | ambari
 ambari | servicecomponent_history      | table | ambari
 ambari | servicecomponent_version      | table | ambari
 ambari | servicecomponentdesiredstate  | table | ambari
 ambari | serviceconfig                 | table | ambari
 ambari | serviceconfighosts            | table | ambari
 ambari | serviceconfigmapping          | table | ambari
 ambari | servicedesiredstate           | table | ambari
 ambari | setting                       | table | ambari
 ambari | stack                         | table | ambari
 ambari | stage                         | table | ambari
 ambari | topology_host_info            | table | ambari
 ambari | topology_host_request         | table | ambari
 ambari | topology_host_task            | table | ambari
 ambari | topology_hostgroup            | table | ambari
 ambari | topology_logical_request      | table | ambari
 ambari | topology_logical_task         | table | ambari
 ambari | topology_request              | table | ambari
 ambari | upgrade                       | table | ambari
 ambari | upgrade_group                 | table | ambari
 ambari | upgrade_item                  | table | ambari
 ambari | users                         | table | ambari
 ambari | viewentity                    | table | ambari
 ambari | viewinstance                  | table | ambari
 ambari | viewinstancedata              | table | ambari
 ambari | viewinstanceproperty          | table | ambari
 ambari | viewmain                      | table | ambari
 ambari | viewparameter                 | table | ambari
 ambari | viewresource                  | table | ambari
 ambari | viewurl                       | table | ambari
 ambari | widget                        | table | ambari
 ambari | widget_layout                 | table | ambari
 ambari | widget_layout_user_widget     | table | ambari
(105 rows)
  1. 查看表结构\d clusterconfig
ambari=> \d clusterconfig
              Table "ambari.clusterconfig"
      Column       |          Type          | Modifiers 
-------------------+------------------------+-----------
 config_id         | bigint                 | not null
 version_tag       | character varying(255) | not null
 version           | bigint                 | not null
 type_name         | character varying(255) | not null
 cluster_id        | bigint                 | not null
 stack_id          | bigint                 | not null
 config_data       | text                   | not null
 config_attributes | text                   | 
 create_timestamp  | bigint                 | not null
Indexes:
    "pk_clusterconfig" PRIMARY KEY, btree (config_id)
    "uq_config_type_tag" UNIQUE CONSTRAINT, btree (cluster_id, type_name, version_tag)
    "uq_config_type_version" UNIQUE CONSTRAINT, btree (cluster_id, type_name, version)
Foreign-key constraints:
    "fk_clusterconfig_cluster_id" FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id)
    "fk_clusterconfig_stack_id" FOREIGN KEY (stack_id) REFERENCES stack(stack_id)
Referenced by:
    TABLE "confgroupclusterconfigmapping" CONSTRAINT "fk_confg" FOREIGN KEY (version_tag, config_type, cluste
r_id) REFERENCES clusterconfig(version_tag, type_name, cluster_id)
    TABLE "serviceconfigmapping" CONSTRAINT "fk_scvm_config" FOREIGN KEY (config_id) REFERENCES clusterconfig
(config_id)
  1. 执行ambari=> \copy clusterconfig to '/tmp/clusterconfig.csv' with csv;导出clusterconfig这个表

  2. 执行ambari=> \q退出

你可能感兴趣的:(如何导出Ambari中的配置表)