[gpadmin@gpmaster ~]$ psql -d gpsun
psql (8.2.15)
Type "help" for help.
gpsun-# \l
List of databases
Name | Owner | Encoding | Access privileges
-----------+---------+----------+---------------------
gpsun | gpadmin | UTF8 |
postgres | gpadmin | UTF8 |
template0 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
template1 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
(4 rows)
gpsun-# ^
gpsun=# create table ljg (name varchar(10),olds numeric(8));
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'name' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
gpsun=# select * from ljg;
name | olds
------+------
(0 rows)
gpsun=# insert into ljg values('ljg',30);
INSERT 0 1
gpsun=# select * from ljg;
name | olds
------+------
ljg | 30
(1 row)
gpsun=# select * from ljg;
name | olds
------+------
ljg | 30
ljg | 34
(2 rows)
gpsun=# update ljg set olds=35 where olds=34;
UPDATE 1
gpsun=# commit;
gpsun=# exit
命令 :gpstart
具体过称为:
[gpadmin@gpmaster ~]$ gpstart
20130816:00:58:00:004099 gpstart:gpmaster:gpadmin-[INFO]:-Starting gpstart with args:
20130816:00:58:00:004099 gpstart:gpmaster:gpadmin-[INFO]:-Gathering information and validating the environment...
20130816:00:58:06:004099 gpstart:gpmaster:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.2.2.4 build 1 Community Edition'
20130816:00:58:08:004099 gpstart:gpmaster:gpadmin-[INFO]:-Greenplum Catalog Version: '201109210'
20130816:00:58:10:004099 gpstart:gpmaster:gpadmin-[WARNING]:-postmaster.pid file exists on Master, checking if recovery startup required
20130816:00:58:10:004099 gpstart:gpmaster:gpadmin-[INFO]:-Commencing recovery startup checks
20130816:00:58:12:004099 gpstart:gpmaster:gpadmin-[INFO]:-No socket connection or lock file in /tmp found for port=5432
20130816:00:58:12:004099 gpstart:gpmaster:gpadmin-[INFO]:-No Master instance process, entering recovery startup mode
20130816:00:58:12:004099 gpstart:gpmaster:gpadmin-[INFO]:-Clearing Master instance pid file
20130816:00:58:12:004099 gpstart:gpmaster:gpadmin-[INFO]:-Starting Master instance in admin mode
20130816:00:58:22:004099 gpstart:gpmaster:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20130816:00:58:22:004099 gpstart:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20130816:00:58:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Setting new master era
20130816:00:58:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Commencing forced instance shutdown
20130816:00:58:42:004099 gpstart:gpmaster:gpadmin-[INFO]:-Starting Master instance in admin mode
20130816:00:58:46:004099 gpstart:gpmaster:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20130816:00:58:46:004099 gpstart:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20130816:00:58:50:004099 gpstart:gpmaster:gpadmin-[INFO]:-Setting new master era
20130816:00:58:50:004099 gpstart:gpmaster:gpadmin-[INFO]:-Master Started...
20130816:00:58:50:004099 gpstart:gpmaster:gpadmin-[INFO]:-Checking for filespace consistency
20130816:00:58:50:004099 gpstart:gpmaster:gpadmin-[INFO]:-Obtaining current filespace entries used by TRANSACTION_FILES
20130816:00:59:01:004099 gpstart:gpmaster:gpadmin-[INFO]:-TRANSACTION_FILES OIDs are consistent for pg_system filespace
20130816:00:59:07:004099 gpstart:gpmaster:gpadmin-[INFO]:-TRANSACTION_FILES entries are consistent for pg_system filespace
20130816:00:59:07:004099 gpstart:gpmaster:gpadmin-[INFO]:-Checking for filespace consistency
20130816:00:59:07:004099 gpstart:gpmaster:gpadmin-[INFO]:-Obtaining current filespace entries used by TEMPORARY_FILES
20130816:00:59:12:004099 gpstart:gpmaster:gpadmin-[INFO]:-TEMPORARY_FILES OIDs are consistent for pg_system filespace
20130816:00:59:16:004099 gpstart:gpmaster:gpadmin-[INFO]:-TEMPORARY_FILES entries are consistent for pg_system filespace
20130816:00:59:16:004099 gpstart:gpmaster:gpadmin-[INFO]:-Shutting down master
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:---------------------------
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Master instance parameters
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:---------------------------
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Database = template1
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Master Port = 5432
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Master directory = /data/master/gpseg-1
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Timeout = 600 seconds
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Master standby = Off
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:---------------------------------------
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:-Segment instances that will be started
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:---------------------------------------
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:- Host Datadir Port
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:- gpnode1 /data/data1/data/gpseg0 40000
20130816:00:59:27:004099 gpstart:gpmaster:gpadmin-[INFO]:- gpnode2 /data/data1/data/gpseg1 40000
Continue with Greenplum instance startup Yy|Nn (default=N):
> y
20130816:01:02:20:004099 gpstart:gpmaster:gpadmin-[INFO]:-No standby master configured. skipping...
20130816:01:02:24:004099 gpstart:gpmaster:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
.........................................................
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-Process results...
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:- Successful segment starts = 2
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:- Failed segment starts = 0
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-Successfully started 2 of 2 segment instances
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:03:21:004099 gpstart:gpmaster:gpadmin-[INFO]:-Starting Master instance gpmaster directory /data/master/gpseg-1
20130816:01:03:28:004099 gpstart:gpmaster:gpadmin-[INFO]:-Command pg_ctl reports Master gpmaster instance active
20130816:01:03:32:004099 gpstart:gpmaster:gpadmin-[INFO]:-Database successfully started
[gpadmin@gpmaster ~]$ psql -d gpsun
psql (8.2.15)
Type "help" for help.
gpsun=#
gpstop
gpstate
[gpadmin@gpmaster ~]$ gpstate
20130816:01:46:21:005122 gpstate:gpmaster:gpadmin-[INFO]:-Starting gpstate with args:
20130816:01:46:23:005122 gpstate:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.2.2.4 build 1 Community Edition'
20130816:01:46:25:005122 gpstate:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.2.2.4 build 1 Community Edition) on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Oct 17 2012 12:26:08'
20130816:01:46:28:005122 gpstate:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20130816:01:46:28:005122 gpstate:gpmaster:gpadmin-[INFO]:-Gathering data from segments...
............................
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-Greenplum instance status summary
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Master instance = Active
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Master standby = No master standby configured
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total segment instance count from metadata = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Primary Segment Status
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total primary segments = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total primary segment valid (at master) = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total primary segment failures (at master) = 0
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number of postmaster.pid files missing = 0
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number of postmaster.pid files found = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number of postmaster.pid PIDs missing = 0
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number of postmaster.pid PIDs found = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number of /tmp lock files missing = 0
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number of /tmp lock files found = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number postmaster processes missing = 0
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Total number postmaster processes found = 2
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Mirror Segment Status
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:- Mirrors not configured on this array
20130816:01:47:02:005122 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
[gpadmin@gpmaster ~]$
在初始化数据库过程中,数据库创建成功,但不能启动连接
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-Process results...
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:- Successful segment starts = 2
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:- Failed segment starts = 0
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-Successfully started 2 of 2 segment instances
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20130815:20:42:02:016261 gpstart:gpmaster:gpadmin-[INFO]:-Starting Master instance gpmaster directory /data/master/gpseg-1
20130815:20:42:09:016261 gpstart:gpmaster:gpadmin-[INFO]:-Command pg_ctl reports Master gpmaster instance active
20130815:20:42:20:016261 gpstart:gpmaster:gpadmin-[WARNING]:-FATAL: DTM initialization: failure during startup/recovery, retry failed, check segment status (cdbtm.c:1468)
20130815:20:42:20:016261 gpstart:gpmaster:gpadmin-[INFO]:-Check status of database with gpstate utility
20130815:20:42:21:003753 gpinitsystem:gpmaster:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
20130815:20:42:22:003753 gpinitsystem:gpmaster:gpadmin-[INFO]:-Loading gp_toolkit...
psql: FATAL: DTM initialization: failure during startup/recovery, retry failed, check segment status (cdbtm.c:1468)
20130815:20:42:29:gpinitsystem:gpmaster:gpadmin-[FATAL]:-Failed to retrieve rolname. Script Exiting!
解决方案:关防火墙
具体命令:
service iptables stop
chkconfig iptables off
[gpadmin@gpmaster ~]$ psql -d gpsun
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[gpadmin@gpmaster ~]$ gpstart
20130815:22:28:28:003675 gpstart:gpmaster:gpadmin-[INFO]:-Starting gpstart with args:
20130815:22:28:28:003675 gpstart:gpmaster:gpadmin-[INFO]:-Gathering information and validating the environment...
20130815:22:28:28:003675 gpstart:gpmaster:gpadmin-[CRITICAL]:-gpstart failed. (Reason='[Errno 2] No such file or directory: '/data/master/postgresql.conf'') exiting...
[gpadmin@gpmaster ~]$
.bash_profile文件中添加
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
[gpadmin@gpmaster ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
source /usr/local/greenplum-db-4.2.2.4/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
========================================================================================
==本博所有内容均由数据库男本人实际工作环境或模拟操作过程,如有编辑错误或其他问题请和本==
==人留言或联系。发扬互联网精神,一起学习,共同努力,完成由专注到卓越的飞跃。?!? ==
==QQ:77113981 !! @ ============= ==
========================================================================================