Pivotal Greenplum® 6.9-安装指南-初始化Greenplum数据库系统

初始化Greenplum数据库系统

介绍如何初始化Greenplum数据库系统。

本章中的说明假定您已按照配置系统中的说明准备好主机, 并根据安装Greenplum数据库软件中的说明,在系统中的所有主机上安装了Greenplum Database软件。

本章包含以下主题:

父主题: 安装和升级Greenplum
 

总览

因为Greenplum数据库是分布式的,所以初始化Greenplum数据库管理系统(DBMS)的过程涉及初始化几个单独的PostgreSQL数据库实例(在Greenplum中称为segment实例)。

每个数据库实例(Master和所有Segment)都必须在系统中的所有主机之间进行初始化,以便它们可以作为统一的DBMS一起工作。Greenplum提供了它自己的初始化数据库工具,名为 gpinitsystem,它负责在master和每个segment实例上初始化数据库,并以正确的顺序启动每个实例。

在初始化并启动Greenplum数据库数据库系统后,您可以通过连接到Greenplum master,就像在一般的PostgreSQL DBMS中一样,创建和管理数据库。

初始化Greenplum数据库

这些是初始化Greenplum数据库的高级任务:

  1. 确保您已完成配置系统安装Greenplum数据库软件中描述的所有安装任务 。
  2. 创建一个主机文件,它包含segment主机的地址 。请参阅创建初始化主机文件
  3. 创建您的Greenplum数据库系统配置文件。请参阅创建Greenplum数据库配置文件
  4. 默认情况下,Greenplum数据库将使用master主机系统的本地化进行初始化。确保这正是您要使用的本地化,因为某些本地化选项在初始化后无法更改。有关更多信息,请参见配置时区和本地化设置
  5. 在master主机上运行Greenplum数据库初始化工具。请参阅 运行初始化实用程序
  6. 设置Greenplum数据库时区。请参阅设置Greenplum数据库时区
  7. 为Greenplum数据库用户设置环境变量。请参阅设置Greenplum环境变量
执行以下初始化任务时,必须以 gpadmin 用户登录到master主机,然后运行Greenplum数据库工具,您必须source greenplum_path.sh文件,来设置Greenplum数据库环境变量。例如,如果您已登录到master,请运行以下命令。
$ su - gpadmin
$ source /usr/local/greenplum-db/greenplum_path.sh

创建初始化主机文件

gpinitsystem工具需要一个主机文件,其中包含每个segment主机的地址列表。该初始化工具通过此种方式确定每个主机的segment实例数量:每个主机列出的主机地址数量,乘以gpinitsystem_config 文件中指定的数据目录位置的数量。

该文件应仅包含segment主机地址(而非主master或备用master)。对于具有多个、未绑定网络接口的segment主机,此文件应列出每个接口的主机地址名称——每行一个。

注意: Greenplum数据库segment主机命名约定为sdwN,其中sdw是前缀, N是整数。例如,sdw2等等。如果主机有多个未绑定的NIC,则约定是在前面加上一个破折号(-),然后输入主机名称。例如,sdw1-1 和 sdw1-2 是主机sdw1的两个接口名称。不过,建议使用NIC绑定来创建负载平衡的、容错的网络。

 

创建初始化主机文件

  1. 创建一个名为 hostfile_gpinitsystem的文件。在此文件中,添加segment主机接口的主机地址名称,每行一个名称,不要有多余的行或空格。例如,如果您有四个segment主机,每个segment主机都有两个未绑定的网络接口:
    sdw1-1
    sdw1-2
    sdw2-1
    sdw2-2
    sdw3-1
    sdw3-2
    sdw4-1
    sdw4-2
  2. 保存并关闭文件。
注意:如果不确定机器所使用的主机名和/或接口地址名称,请查看/etc/hosts文件。

创建Greenplum数据库配置文件

您的Greenplum数据库配置文件告诉 gpinitsystem 工具,您要如何配置Greenplum数据库系统。示例配置文件位于$GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config

创建一个gpinitsystem_config文件

  1. 复制一份 gpinitsystem_config文件,来作为起始点。例如:
    $ cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config \
         /home/gpadmin/gpconfigs/gpinitsystem_config
  2. 在文本编辑器中打开您刚刚复制的文件。

    根据您的环境设置所有必需的参数。更多信息请查阅gpinitsystem。Greenplum数据库系统必须包含一个master实例和至少两个segment实例(即使设置一个单节点系统)。

    DATA_DIRECTORY 参数确定每个主机将创建多少segment。如果segment主机具有多个网络接口,并且在主机文件中使用了它们的接口地址名称,则segment数将平均分配到可用的网络接口数上。

    要指定 PORT_BASE,请查看/etc/sysctl.conf文件中的参数net.ipv4.ip_local_port_range。请参阅“ 推荐的OS参数设置”

    以下是gpinitsystem_config 文件中的必需参数的一个示例:

    ARRAY_NAME="Greenplum Data Platform"
    SEG_PREFIX=gpseg
    PORT_BASE=6000 
    declare -a DATA_DIRECTORY=(/data1/primary /data1/primary /data1/primary /data2/primary /data2/primary /data2/primary)
    MASTER_HOSTNAME=mdw 
    MASTER_DIRECTORY=/data/master 
    MASTER_PORT=5432 
    TRUSTED SHELL=ssh
    CHECK_POINT_SEGMENTS=8
    ENCODING=UNICODE
  3. (可选)如果要部署镜像segment,请取消其注释并根据您的环境设置镜像参数。要指定MIRROR_PORT_BASE,请查看/etc/sysctl.conf文件中的参数net.ipv4.ip_local_port_range 。以下是gpinitsystem_config 文件中可选 镜像参数的一个示例:
    MIRROR_PORT_BASE=7000
    declare -a MIRROR_DATA_DIRECTORY=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)
    注意:您可以仅使用主segment来初始化Greenplum系统,然后使用gpaddmirrors 工具来部署镜像。
  4. 保存并关闭文件。

运行初始化工具

gpinitsystem 工具使用配置文件中定义的值来创建Greenplum数据库系统。

以下步骤假定您以 gpadmin 用户登录,并已source greenplum_path.sh 文件来设置Greenplum数据库环境变量。

运行初始化工具

  1. 运行以下命令,引用初始化配置文件(gpinitsystem_config)和主机文件(hostfile_gpinitsystem)的路径及文件名。例如:
    $ cd ~
    $ gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/hostfile_gpinitsystem

    对于完全冗余的系统(具有备用master和扩展镜像配置),请包括-s 和 -S选项。例如:

    $ gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/hostfile_gpinitsystem \
      -s standby_master_hostname -S

     

  2. 该工具将验证您的设置信息,并确保它可以连接到每个主机,并能访问配置中指定的数据目录。如果所有预检查均成功,该工具将提示您确认配置。例如:
    => Continue with Greenplum creation? Yy/Nn
  3. 按 y 开始初始化。
  4. 然后,该工具将开始设置和初始化系统中的master实例和每个segment实例。每个segment实例是并行设置的。取决于segment的数量,此过程可能需要一些时间。
  5. 成功完成安装后,该工具将启动Greenplum数据库系统。您应该看到:
    => Greenplum Database instance successfully created.

解决初始化问题

如果该工具在设置实例时遇到任何错误,则整个过程将失败,并可能留给您一个部分创建的系统。请参考错误消息和日志,以确定故障原因以及故障发生在何处。日志文件创建于~/gpAdminLogs。

根据过程中发生错误的时机,您可能需要清理,然后再次尝试 gpinitsystem工具。例如,如果有些segment实例被成功创建而有些失败,则您可能需要停止Postgres 进行,并从您的数据存储区中,删除所有由该工具创建的数据目录。如有必要,创建一个回退脚本来帮助进行此清理。

使用回退脚本

如果gpinitsystem工具失败,如果它使您的系统处于部分安装状态,那么它将创建以下的回退脚本:

~/gpAdminLogs/backout_gpinitsystem_<user>_<timestamp>

您可以使用此脚本清除部分创建的Greenplum数据库系统。该回退脚本将删除所有由工具创建的数据目录、Postgres进程和日志文件。更正了导致gpinitsystem失败的错误之后,运行回退脚本,准备好重新尝试初始化Greenplum数据库阵列。

以下示例显示了如何运行回退脚本:

$ sh backout_gpinitsystem_gpadmin_20071031_121053

设置Greenplum数据库时区

作为一个最佳实践,使用已知的、受支持的时区,配置Greenplum数据库和主机系统。Greenplum数据库使用来自一组内部存储的PostgreSQL时区中的一个时区。设置Greenplum数据库时区可防止Greenplum数据库在每次重新启动集群时,选择并设置此时区为Greenplum数据库master和segment实例的时区。

使用 gpconfig工具来显示和设置Greenplum数据库时区。例如,以下命令显示Greenplum数据库时区,并将时区设置为 美国/太平洋。

$ gpconfig -s TimeZone
$ gpconfig -c TimeZone -v 'US/Pacific'

更改时区后,必须重新启动Greenplum数据库。命令gpstop -ra可重启Greenplum数据库。目录视图 pg_timezone_names 提供了Greenplum数据库的时区信息。

有关Greenplum数据库时区的更多信息,请参阅配置时区和本地化设置

设置Greenplum环境变量

您必须在Greenplum数据库用户(gpadmin)环境下设置环境变量,此用户环境是Greenplum master和备用master主机上运行Greenplum数据库的环境。在Greenplum数据库安装目录中提供了一个greenplum_path.sh 文件,其中包含Greenplum数据库的环境变量设置。

Greenplum数据库管理工具还要求设置环境变量MASTER_DATA_DIRECTORY。它应该指向主数据目录下、由gpinitsystem工具创建的目录。

注:该greenplum_path.sh脚本更改操作环境,以支持运行Greenplum数据库特定的工具。这些对环境的相同更改,可能会对其他系统级程序的运行产生负面影响,例如 ps 或 yum。使用单独的帐户执行系统管理和数据库管理,而不是尝试以gpadmin同时执行这两种功能。
 

这些步骤确保了系统重启之后,能为gpadmin 用户设置环境变量。

为Greenplum数据库设置gpadmin环境

  1. 在文本编辑器中打开 gpadmin 配置文件(例如 .bashrc)。例如:
    $ vi ~/.bashrc
  2. 在文件中添加几行,来source greenplum_path.sh 文件,并设置 MASTER_DATA_DIRECTORY环境变量。例如:
    source /usr/local/greenplum-db/greenplum_path.sh
    export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
  3. (可选)为了方便起见,您可能还需要设置一些客户端会话环境变量,例如PGPORT, PGUSER 和 PGDATABASE 。例如:
    export PGPORT=5432
    export PGUSER=gpadmin 
    export PGDATABASE=default_login_database_name
  4. (可选)如果您使用RHEL 7或CentOS 7,则将以下行添加到 .bashrc 文件的末尾,以在greenplum_path.sh 环境中启用 ps 命令:
    export LD_PRELOAD=/lib64/libz.so.1 ps
  5. 保存并关闭文件。
  6. 编辑配置文件后,source 它以使更改生效。例如:
    $ source ~/.bashrc
  7. 如果您有备用master主机,也将您的环境文件复制到备用master。例如:
    $ cd ~
    $ scp .bashrc standby_hostname:`pwd`
注:该.bashrc文件不应产生任何输出。如果您希望在登录时向用户显示消息,请使用.bash_profile 文件代替。

下一步

系统启动并运行后,接下来的步骤是:

允许客户端连接

首次初始化Greenplum数据库后,它将仅允许以 gpadmin 角色(或能运行 gpinitsystem的任何系统用户),从本地连接到数据库。如果您希望其他用户或客户端计算机能够连接到Greenplum数据库,则必须授予他们访问权限。有关更多信息,请参见Greenplum数据库管理员指南

创建数据库并加载数据

验证安装后,您可能要开始创建数据库并加载数据。有关在Greenplum数据库中创建数据库,模式,表和其他数据库对象以及加载数据的更多信息,请参见Greenplum数据库管理员指南中的定义数据库对象以及 加载和卸载数据。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
greenplum-db-6.2.1-rhel7-x86_64.rpm Pivotal Greenplum 6.2 Release Notes This document contains pertinent release information about Pivotal Greenplum Database 6.2 releases. For previous versions of the release notes for Greenplum Database, go to Pivotal Greenplum Database Documentation. For information about Greenplum Database end of life, see Pivotal Greenplum Database end of life policy. Pivotal Greenplum 6 software is available for download from the Pivotal Greenplum page on Pivotal Network. Pivotal Greenplum 6 is based on the open source Greenplum Database project code. Important: Pivotal Support does not provide support for open source versions of Greenplum Database. Only Pivotal Greenplum Database is supported by Pivotal Support. Release 6.2.1 Release Date: 2019-12-12 Pivotal Greenplum 6.2.1 is a minor release that includes new features and resolves several issues. New Features Greenplum Database 6.2.1 includes these new features: Greenplum Database supports materialized views. Materialized views are similar to views. A materialized view enables you to save a frequently used or complex query, then access the query results in a SELECT statement as if they were a table. Materialized views persist the query results in a table-like form. Materialized view data cannot be directly updated. To refresh the materialized view data, use the REFRESH MATERIALIZED VIEW command. See Creating and Managing Materialized Views. Note: Known Issues and Limitations describes a limitation of materialized view support in Greenplum 6.2.1. The gpinitsystem utility supports the --ignore-warnings option. The option controls the value returned by gpinitsystem when warnings or an error occurs. If you specify this option, gpinitsystem returns 0 if warnings occurred during system initialization, and returns a non-zero value if a fatal error occurs. If this option is not specified, gpinitsystem returns 1 if initialization completes with warnings, and returns value of 2 or greater if a fatal error occurs. PXF version 5.10.0 is included, which introduces several new and changed features and bug fixes. See PXF Version 5.10.0 below. PXF Version 5.10.0 PXF 5.10.0 includes the following new and changed features: PXF has improved its performance when reading a large number of files from HDFS or an object store. PXF bundles newer tomcat and jackson libraries. The PXF JDBC Connector now supports pushdown of OR and NOT logical filter operators when specified in a JDBC named query or in an external table query filter condition. PXF supports writing Avro-format data to Hadoop and object stores. Refer to Reading and Writing HDFS Avro Data for more information about this feature. PXF is now certified with Hadoop 2.x and 3.1.x and Hive Server 2.x and 3.1, and bundles new and upgraded Hadoop libraries to support these versions. PXF supports Kerberos authentication to Hive Server 2.x and 3.1.x. PXF supports per-server user impersonation configuration. PXF supports concurrent access to multiple Kerberized Hadoop clusters. In previous releases of Greenplum Database, PXF supported accessing a single Hadoop cluster secured with Kerberos, and this Hadoop cluster must have been configured as the default PXF server. PXF introduces a new template file, pxf-site.xml, to specify the Kerberos and impersonation property settings for a Hadoop or JDBC server configuration. Refer to About Kerberos and User Impersonation Configuration (pxf-site.xml) for more information about this file. PXF now supports connecting to Hadoop with a configurable Hadoop user identity. PXF previously supported only proxy access to Hadoop via the gpadmin Greenplum user. PXF version 5.10.0 deprecates the following configuration properties. Note: These property settings continue to work. The PXF_USER_IMPERSONATION, PXF_PRINCIPAL, and PXF_KEYTAB settings in the pxf-env.sh file. You can use the pxf-site.xml file to configure Kerberos and impersonation settings for your new Hadoop server configurations. The pxf.impersonation.jdbc property setting in the jdbc-site.xml file. You can use the pxf.service.user.impersonation property to configure user impersonation for a new JDBC server configuration. Note: If you have previously configured a PXF JDBC server to access Kerberos-secured Hive, you must upgrade the server definition. See Upgrading PXF in Greenplum 6.x for more information. Changed Features Greenplum Database 6.2.1 includes these changed features: Greenplum Stream Server version 1.3.1 is included in the Greenplum distribution. Resolved Issues Pivotal Greenplum 6.2.1 is a minor release that resolves these issues: 29454 - gpstart During Greenplum Database start up, the gpstart utility did not report when a segment instance failed to start. The utility always displayed 0 skipped segment starts. This issue has been resolved. gpstart output was also enhanced to provide additional warnings and summary information about the number of skipped segments. For example: [WARNING]:-********
要在Linux上安装Greenplum数据库,可以按照以下步骤进行操作: 1. 首先,确保您的Linux系统满足Greenplum的最低系统要求。您可以在Greenplum官方文档中找到这些要求。 2. 下载Greenplum安装包。您可以从Pivotal Software(现在是VMware Tanzu Greenplum)的官方网站上获取安装包。请根据您的操作系统版本选择正确的安装包。 3. 解压安装包。使用以下命令解压下载的安装包文件: ``` tar xvzf greenplum-db-<version>.tar.gz ``` 4. 切换到解压后的目录。使用以下命令进入安装目录: ``` cd greenplum-db-<version> ``` 5. 运行安装程序。使用以下命令运行Greenplum安装程序: ``` ./configure --prefix=<installation_directory> ``` 其中,`<installation_directory>` 是您想要安装Greenplum的目录路径。 6. 编译和安装。运行以下命令编译和安装Greenplum: ``` make && make install ``` 7. 配置环境变量。编辑您的`~/.bashrc`文件,并添加以下行来配置Greenplum的环境变量: ``` export GPHOME=<installation_directory> export PATH=$GPHOME/bin:$PATH ``` 然后使用以下命令使配置生效: ``` source ~/.bashrc ``` 8. 初始化Greenplum数据库。使用以下命令初始化Greenplum数据库: ``` gpseginstall -f <hostfile> ``` 其中,`<hostfile>` 是一个包含所有Greenplum主机名的文本文件。 9. 启动Greenplum数据库。使用以下命令启动Greenplum数据库: ``` gpstart ``` 10. 进行后续配置和管理。根据您的需求,可以进行进一步的配置和管理,例如创建数据库、设置用户权限等。 请注意,以上步骤仅提供了基本的安装过程,具体步骤可能会因不同版本的Greenplum而有所变化。建议您参考Greenplum官方文档或提供的安装指南以获取更详细的信息和指导。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值