pdf文档 Greenplum 编译安装和调试

2.07 MB 15 页 0 评论
语言
中文(简体)
格式
.pdf
评分
3
摘要
Greenplum 编译安装和调试 本文先介绍如何从源代码编译安装Greenplum、初始化Greenplum集群。然后介绍SQL在 Greenplum中的典型执行路径,最后介绍一些调试技巧。 源代码使用 Greenplum 开源社区最新源代码 6X_STABLE 分支: https://github.com/greenplum-db/gpdb​,内核代码基于 PostgreSQL 9.4。目前(2019/04/23) 主 干分支的代码基于 PostgreSQL 9.4。合并到 PostgreSQL 9.5 的工作也已经开始,有关最新工作 进展请参见:​https://github.com/greenplum-db/gpdb-postgres-merge​。 1. 从源代码编译 Greenplum Greenplum 目前官方支持 Redhat/Centos/SuSE/Ubuntu 等Linux系统。大量开发人员包括我自己 使用Mac系统,但是不在官方支持列表中。 1.1 在 Mac 系统上编译 首先需要关闭苹果操作系统的 SIP 特性,否则无法初始化集群。 1. 重启操作系统 2. 重启过程中按下 command+R 进入恢复模式 3. 从 Utilities 菜单选择 Terminal 4. 执行 csrutil disable 5. 重启操作系统 // 安装Greenplum管理脚本依赖的 Python 包 $ wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py $ sudo pip install psutil lockfile paramiko setuptools epydoc // 需要安装 openssl,否则无法编译 $ brew install openssl && brew link openssl --force $ CPPFLAGS="-I/usr/local/include/ -I/usr/local/opt/openssl/include" \ LDFLAGS="-L/usr/local/lib -L/usr/local/opt/openssl/lib" \ CFLAGS="-O0 -g3 -ggdb3" \ ./configure --with-perl --with-python --with-libxml \ --enable-debug --enable-cassert --disable-orca --disable-gpcloud \ --disable-gpfdist --prefix=$HOME/gpdb.master $ make [-j4] $ make install 在苹果系统上初始化Greenplum单节点集群时,需要做些准备工作: ● 添加​export PGHOST=localhost​至​~/.bash_profile ● 将本机的​hostname​与​127.0.0.1​的map写到/etc/hosts中。例如 127.0.0.1 yydzero yydzero.local ● 修改​/etc/sysctl.conf​文件,并重启: kern​.​sysv​.​shmmax​=​2147483648 kern​.​sysv​.​shmmin​=​1 kern​.​sysv​.​shmmni​=​64 kern​.​sysv​.​shmseg​=​16 kern​.​sysv​.​shmall​=​524288 kern​.​maxfiles​=​65535 kern​.​maxfilesperproc​=​65535 net​.​inet​.​tcp​.​msl​=​60 $ cd gpAux/gpdemo $ source $HOME/gpdb.master/greenplum_path.sh $ export PGHOST=`hostname` $ make $ source gpdemo-env.sh $ psql postgres postgres# SELECT version() 有关更详细的信息请参考 README.macOS.md。 1.2 在 Redhat/Centos 系统上编译 本小节以 RHEL7 为例介绍如何编译Greenplum。 首先下载 Greenplum 源代码 $ git clone https​:​//github.com/greenplum-db/gpdb Greenplum Database 编译和运行依赖于各种系统库和Python库。需要先安装这些依赖: $ sudo ​yum groupinstall 'Development Tools' # GCC, libtools etc $ sudo yum install curl​-​devel bzip2​-​devel python​-​devel openssl​-​devel readline-devel $ sudo yum install perl​-​ExtUtils​-​Embed​ ​# If enable perl $ sudo yum install libxml2​-​devel ​# If enable XML support $ sudo yum install openldap​-​devel ​# If enable LDAP $ sudo yum install pam pam​-​devel ​# If enable PAM $ sudo yum install perl​-​devel ​# If need installcheck-world $ wget https​:​//bootstrap.pypa.io/get-pip.py $ sudo python ​get​-​pip​.​py $ sudo pip install psutil lockfile paramiko setuptools epydoc 编译 Greenplum Database 源代码,假定安装到 $HOME/gpdb.master 目录下 $ CFLAGS="-O0 -g3 -ggdb3" \ ./configure --with-perl --with-python --with-libxml --enable-debug --enable-cassert \ --disable-orca --disable-gpcloud --disable-gpfdist \ --disable-gpfdist --prefix=/home/gpadmin/gpdb.master $ make $ make install $ cd gpAux/gpdemo $ source /home/gpadmin/gpdb.master/greenplum_path.sh $ export PGHOST=`hostname` $ make $ source gpdemo-env.sh $ psql postgres postgres# SELECT version() version ---------------------------------------------------------------------------------------------------------- PostgreSQL 8.3.23 (Greenplum Database 5.4.1+dev.56.gcdfadd9 build dev) ... postgres=# SELECT * FROM gp_segment_configuration ; dbid | content | role | preferred_role | mode | status | port | hostname | address | replication_port ------+---------+------+----------------+------+--------+-------+----------+---------+------------------ 1 | -1 | p | p | s | u | 15432 | g20 | g20 | 2 | 0 | p | p | s | u | 25432 | g20 | g20 | 25438 3 | 1 | p | p | s | u | 25433 | g20 | g20 | 25439 4 | 2 | p | p | s | u | 25434 | g20 | g20 | 25440 5 | 0 | m | m | s | u | 25435 | g20 | g20 | 25441 6 | 1 | m | m | s | u | 25436 | g20 | g20 | 25442 7 | 2 | m | m | s | u | 25437 | g20 | g20 | 25443 2. 初始化 Greenplum 集群 前面编译部分介绍了如何使用 Greenplum 源代码中的 demo 集群脚本创建集群。这种方法简单快 捷,然而屏蔽了很多细节。 2.1 手工集群初始化 下面介绍如何手工部署一个单机集群:在一台笔记本上安装一个Greenplum的集群,包括一个 master,两个segments。 # step 0. 系统环境配置 $ /etc/sysctl.conf kernel.shmmax = 500000000 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 250 512000 100 2048 kernel.sysrq = 1 kernel.core_uses_pid = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.msgmni = 2048 net.ipv4.tcp_syncookies = 1 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_max_syn_backlog = 4096 net.ipv4.conf.all.arp_filter = 1 net.ipv4.ip_local_port_range = 10000 65535 net.core.netdev_max_backlog = 10000 net.core.rmem_max = 2097152 net.core.wmem_max = 2097152 vm.overcommit_memory = 2 $ cat /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072 $ sudo reboot # step 1. source一些环境变量, 例如PATH $ source $HOME​/​gpdb​.​master​/​greenplum_path​.​sh # step 2. 交换集群中所有机器的ssh密钥, 我们这里只有一台机器 $ gpssh​-​exkeys ​-​h ​`hostname` # step 3. 生成三个配置文件: env.sh, hostfile, gpinitsystem_config $ cat env​.​sh source $HOME​/​gpdb​.​master​/​greenplum_path​.​sh export​ PGPORT​=​5432 export​ MASTER_DATA_DIRECTORY​=​$HOME​/​data​/​master​/​gpseg​-​1 # hostfile 包括集群中所有机器的hostname, 我们这里只有一台 $ cat hostfile <your_hostname> $ cat gpinitsystem_config ARRAY_NAME​=​"Open Source Greenplum" SEG_PREFIX​=​gpseg PORT_BASE​=​40000 # 根据需要,修改下面的路径和主机名 # 有几个DATA_DIRECTORY, 每个节点上便会启动几个segments declare ​-​a DATA_DIRECTORY​=(/​path​/​to​/​your​/​data ​/​path​/​to​/​your​/​data​) # master的主机名, 路径和端口 MASTER_HOSTNAME​=​your_hostname MASTER_DIRECTORY​=​/path/​to​/​your​/​data​/​master MASTER_PORT​=​5432 TR...
来源cn.greenplum.org
Greenplum 编译安装和调试 第2页
Greenplum 编译安装和调试 第3页
下载文档到本地,方便使用
共 15 页, 还有 5 页可预览, 继续阅读
文档评分
请文明评论,理性发言.