Repository: bigtop Updated Branches: refs/heads/master a58f3ee8b -> 0bb54e518
BIGTOP-3118. [Puppet] Failed to deploy GPDB Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/0bb54e51 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/0bb54e51 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/0bb54e51 Branch: refs/heads/master Commit: 0bb54e518d01d18325b18cfa2b9a91f1f6e00692 Parents: a58f3ee Author: Evans Ye <[email protected]> Authored: Wed Dec 26 01:14:02 2018 +0800 Committer: Evans Ye <[email protected]> Committed: Thu Jan 3 17:07:22 2019 +0800 ---------------------------------------------------------------------- .../puppet/modules/gpdb/manifests/init.pp | 42 +++++++++++++------- .../puppet/modules/gpdb/templates/gp_dbid | 2 +- .../puppet/modules/gpdb/templates/init-db.sh | 2 +- .../templates/insert-to-faultStrategy-table.sh | 2 +- .../templates/insert-to-segmentConfig-table.sh | 2 +- .../modules/gpdb/templates/postmaster.opts | 2 +- .../templates/start-master-db-in-admin-mode.sh | 2 +- .../puppet/modules/gpdb/templates/stop-db.sh | 4 +- .../modules/gpdb/templates/test-master-db.sh | 2 +- 9 files changed, 37 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/manifests/init.pp ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/manifests/init.pp b/bigtop-deploy/puppet/modules/gpdb/manifests/init.pp index 98475a3..ce711b8 100644 --- a/bigtop-deploy/puppet/modules/gpdb/manifests/init.pp +++ b/bigtop-deploy/puppet/modules/gpdb/manifests/init.pp @@ -64,6 +64,7 @@ class gpdb { class { 'gpdb::common::stop_master_in_admin_mode': base_dir => "$db_base_dir", + nodes => $nodes, gp_home => $gp_home, master_port => $master_db_port, require => Class['gpdb::common::configure_master_node'] @@ -75,7 +76,7 @@ class gpdb { db_base_dir => $gpdb::common::db_base_dir, master_db_port => $gpdb::common::master_db_port, segment_db_port_prefix => $gpdb::common::segment_db_port_prefix, - require => Class['gpdb::common::stop_master_in_admin_mode'], + require => [ Server["stop_if_running"], Class['gpdb::common::stop_master_in_admin_mode'] ], start_or_stop => running, } @@ -107,17 +108,23 @@ class gpdb { package { ["python-lockfile"]: ensure => latest, } + package { ["gcc"]: + ensure => latest, + } + package { ["python-devel"]: + ensure => latest, + } package { ["psutil"]: ensure => latest, provider => pip, - require => Package["python-pip"], + require => [ File["/usr/bin/pip-python"], Package["gcc"], Package["python-devel"] ], } package { ["paramiko"]: ensure => latest, provider => pip, - require => Package["python-pip"], + require => File["/usr/bin/pip-python"], } - package { ["python-pip"]: + package { ["python2-pip"]: ensure => latest, require => [ Yumrepo["epel"], @@ -125,10 +132,15 @@ class gpdb { Package["python-lockfile"], ], } + file { '/usr/bin/pip-python': + ensure => 'link', + require => Package["python2-pip"], + target => '/usr/bin/pip', + } } /(?i:(SLES|opensuse))/: { } - Amazon: { } + /(Amazon)/: { } /(Ubuntu|Debian)/: { package { ["libffi-dev"]: ensure => latest, @@ -274,15 +286,17 @@ class gpdb { } } - class stop_master_in_admin_mode($base_dir = undef, $gp_home = undef, $master_port = undef){ - exec { 'stop-master-db-in-admin-mode': - command => "stop-db.sh $base_dir/master/gpseg-1 $master_port", - path => '/home/gpadmin', - user => 'gpadmin', - require => [ - Exec["create_master_db$base_dir/master/gpseg-1"], - File['/home/gpadmin/stop-db.sh'] - ], + class stop_master_in_admin_mode($nodes = undef, $base_dir = undef, $gp_home = undef, $master_port = undef){ + if ($::fqdn == $nodes[0]) { + exec { 'stop-master-db-in-admin-mode': + command => "stop-db.sh $base_dir/master/gpseg-1 $master_port", + path => '/home/gpadmin', + user => 'gpadmin', + require => [ + Exec["create_master_db$base_dir/master/gpseg-1"], + File['/home/gpadmin/stop-db.sh'] + ], + } } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/gp_dbid ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/gp_dbid b/bigtop-deploy/puppet/modules/gpdb/templates/gp_dbid index 2066b20..ea764ca 100755 --- a/bigtop-deploy/puppet/modules/gpdb/templates/gp_dbid +++ b/bigtop-deploy/puppet/modules/gpdb/templates/gp_dbid @@ -1,3 +1,3 @@ # Greenplum Database identifier for this master/segment. # Do not change the contents of this file. -dbid = <%= dbid %> +dbid = <%= @dbid %> http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/init-db.sh ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/init-db.sh b/bigtop-deploy/puppet/modules/gpdb/templates/init-db.sh index b194526..5976728 100755 --- a/bigtop-deploy/puppet/modules/gpdb/templates/init-db.sh +++ b/bigtop-deploy/puppet/modules/gpdb/templates/init-db.sh @@ -1,4 +1,4 @@ #!/bin/sh if [ ! -d $1 ]; then - export LD_LIBRARY_PATH=<%= gp_home%>/lib:/lib;<%= gp_home%>/bin/initdb -E UNICODE -D $1 --locale=en_US.utf8 --max_connections=750 --shared_buffers=128000kB --is_filerep_mirrored=no --backend_output=$1.initdb + export LD_LIBRARY_PATH=<%= @gp_home %>/lib:/lib;<%= @gp_home %>/bin/initdb -E UNICODE -D $1 --locale=en_US.utf8 --max_connections=750 --shared_buffers=128000kB --is_filerep_mirrored=no --backend_output=$1.initdb fi http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-faultStrategy-table.sh ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-faultStrategy-table.sh b/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-faultStrategy-table.sh index aeff932..c1f9769 100755 --- a/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-faultStrategy-table.sh +++ b/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-faultStrategy-table.sh @@ -1,2 +1,2 @@ #!/bin/sh -<%= gp_home%>/bin/psql -p <%= master_port%> -d "template1" -c "insert into gp_fault_strategy(fault_strategy) values ('n');" || true +<%= @gp_home %>/bin/psql -p <%= @master_port %> -d "template1" -c "insert into gp_fault_strategy(fault_strategy) values ('n');" || true http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-segmentConfig-table.sh ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-segmentConfig-table.sh b/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-segmentConfig-table.sh index 9bde305..5e4b381 100755 --- a/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-segmentConfig-table.sh +++ b/bigtop-deploy/puppet/modules/gpdb/templates/insert-to-segmentConfig-table.sh @@ -1,2 +1,2 @@ #!/bin/sh -<%= gp_home%>/bin/psql -p <%= master_port%> -d "template1" -c "INSERT INTO gp_segment_configuration (dbid, content, role, preferred_role, mode, status, hostname, address, port, replication_port) VALUES ($1, $2, 'p', 'p', 's', 'u', '$4', '$4', $3, null);insert into pg_filespace_entry (fsefsoid, fsedbid, fselocation) values (3052, $1, '$5');" || true \ No newline at end of file +<%= @gp_home %>/bin/psql -p <%= @master_port %> -d "template1" -c "INSERT INTO gp_segment_configuration (dbid, content, role, preferred_role, mode, status, hostname, address, port, replication_port) VALUES ($1, $2, 'p', 'p', 's', 'u', '$4', '$4', $3, null);insert into pg_filespace_entry (fsefsoid, fsedbid, fselocation) values (3052, $1, '$5');" || true http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/postmaster.opts ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/postmaster.opts b/bigtop-deploy/puppet/modules/gpdb/templates/postmaster.opts index 96e2212..e897635 100755 --- a/bigtop-deploy/puppet/modules/gpdb/templates/postmaster.opts +++ b/bigtop-deploy/puppet/modules/gpdb/templates/postmaster.opts @@ -1 +1 @@ -<%= gp_home%>/bin/postgres "-D" "<%= db_dir %>" "-p" "<%= port %>" "-b" "<%= dbid %>" "-z" "<%= z_options %>" "--silent-mode=true" "-i" "-M" "<%= m_options %>" "-C" "<%= content %>" <%= x_options %> +<%= @gp_home %>/bin/postgres -D <%= @db_dir %> -p <%= @port %> --gp_dbid=<%= @dbid %> --gp_num_contents_in_cluster=<%= @z_options %> --silent-mode=true -i -M <%= @m_options %> --gp_contentid=<%= @content %> <%= @x_options %> http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/start-master-db-in-admin-mode.sh ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/start-master-db-in-admin-mode.sh b/bigtop-deploy/puppet/modules/gpdb/templates/start-master-db-in-admin-mode.sh index 3966e41..441492d 100755 --- a/bigtop-deploy/puppet/modules/gpdb/templates/start-master-db-in-admin-mode.sh +++ b/bigtop-deploy/puppet/modules/gpdb/templates/start-master-db-in-admin-mode.sh @@ -1,2 +1,2 @@ #!/bin/bash -export PGPORT=<%= master_port%>;<%= gp_home%>/bin/pg_ctl -w -l $1/pg_log/startup.log -D $1 -o "-i -p <%= master_port%> -c gp_role=utility -M master -b 1 -C -1 -z 0 -m" start \ No newline at end of file +export PGPORT=<%= @master_port %>; <%= @gp_home %>/bin/pg_ctl -w -l $1/pg_log/startup.log -D $1 -o "-p <%= @master_port %> --gp_dbid=1 --gp_num_contents_in_cluster=0 --silent-mode=true -i -M master --gp_contentid=-1 -x 0 -c gp_role=utility -m" start http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/stop-db.sh ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/stop-db.sh b/bigtop-deploy/puppet/modules/gpdb/templates/stop-db.sh index 5394b8a..c1eea6f 100644 --- a/bigtop-deploy/puppet/modules/gpdb/templates/stop-db.sh +++ b/bigtop-deploy/puppet/modules/gpdb/templates/stop-db.sh @@ -1,2 +1,2 @@ -#!/bin/sh -<%= gp_home%>/bin/pg_ctl -p $2 -D $1 stop \ No newline at end of file +#!/bin/bash +<%= @gp_home %>/bin/pg_ctl -p $2 -D $1 stop http://git-wip-us.apache.org/repos/asf/bigtop/blob/0bb54e51/bigtop-deploy/puppet/modules/gpdb/templates/test-master-db.sh ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/gpdb/templates/test-master-db.sh b/bigtop-deploy/puppet/modules/gpdb/templates/test-master-db.sh index 141cd3d..0934dbb 100644 --- a/bigtop-deploy/puppet/modules/gpdb/templates/test-master-db.sh +++ b/bigtop-deploy/puppet/modules/gpdb/templates/test-master-db.sh @@ -1,2 +1,2 @@ #!/bin/sh -<%= gp_home%>/bin/psql -p <%= master_port%> -d "template1" -c "select count(*) from gp_segment_configuration;" \ No newline at end of file +<%= @gp_home %>/bin/psql -p <%= @master_port %> -d "template1" -c "select count(*) from gp_segment_configuration;"
