GP資料庫安裝后正常運行,服務器被惡意連接故修改密碼后重啟,GP資料庫也需要重新啟動,這個重新啟動的程序坑坑洼洼 🐾 列印的日志資訊進行了處理,洗掉了一些冗余,
5次報錯及解決
第 1?? 次報錯
# 服務器重啟后 啟動GP
[gpadmin@tcloud /]$ /usr/local/greenplum-db/bin/gpstart
Traceback (most recent call last):
File "./bin/gpstart", line 12, in <module>
from gppylib.mainUtils import *
ImportError: No module named gppylib.mainUtils
第 2?? 次報錯
第1次報錯的原因是 greenplum_path.sh 組態檔未生效,
# 生效 greenplum_path.sh后 啟動GP
[gpadmin@tcloud /]$ source /usr/local/greenplum-db/greenplum_path.sh
[gpadmin@tcloud /]$ /usr/local/greenplum-db/bin/gpstart
20210901:09:16:59:028877 gpstart:tcloud:gpadmin-[INFO]:
-Starting gpstart with args:
-Gathering information and validating the environment...
20210901:09:16:59:028877 gpstart:tcloud:gpadmin-[CRITICAL]:
-gpstart failed. (Reason='Environment Variable MASTER_DATA_DIRECTORY not set!') exiting...
第 3?? 次報錯
第2次報錯的原因是 .bashrc 組態檔未生效,
# 生效.bashrc后 啟動GP
[gpadmin@tcloud /]$ source /home/greenplum/.bashrc
[gpadmin@tcloud /]$ /usr/local/greenplum-db/bin/gpstart
20210901:09:23:19:030476 gpstart:tcloud:gpadmin-[INFO]:
-Starting gpstart with args:
-Gathering information and validating the environment...
20210901:09:23:19:030476 gpstart:tcloud:gpadmin-[CRITICAL]:
-gpstart failed. (Reason='[Errno 2] No such file or directory:
'/home/greenplum/gpdata/master/postgresql.conf'') exiting...
第 4?? 次報錯
第3次報錯的原因是 MASTER_DATA_DIRECTORY 配置錯誤,重新組態檔夾位置,
# 修改.bash_profile檔案
[gpadmin@tcloud /]$ vim /home/gpadmin/.bash_profile
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/home/greenplum/gpdata/master/gpseg-1
# 生效.bash_profile后 啟動GP
[gpadmin@tcloud /]$ source /home/gpadmin/.bash_profile
[gpadmin@tcloud /]$ /usr/local/greenplum-db/bin/gpstart
20210901:10:04:58:007993 gpstart:tcloud:gpadmin-[INFO]:
-Starting gpstart with args:
-Gathering information and validating the environment...
-Greenplum Binary Version: 'postgres (Greenplum Database) 6.13.0 build
commit:4f1adf8e247a9685c19ea02bcaddfdc200937ecd Open Source'
-Greenplum Catalog Version: '301908232'
20210901:10:04:58:007993 gpstart:tcloud:gpadmin-[WARNING]:
-postmaster.pid file exists on Master, checking if recovery startup required
20210901:10:04:58:007993 gpstart:tcloud:gpadmin-[INFO]:
-Commencing recovery startup checks
20210901:10:04:58:007993 gpstart:tcloud:gpadmin-[CRITICAL]:
-Command netstat not found
-gpstart failed. (Reason='Could not locate command: 'netstat' in this set of paths:
['/usr/kerberos/bin', '/usr/sfw/bin', '/opt/sfw/bin', '/bin', '/usr/local/bin', '/usr/bin',
'/sbin', '/usr/sbin', '/usr/ucb', '/sw/bin', '/opt/Navisphere/bin', '/usr/local/greenplum-db-
6.13.0']') exiting...
第 5?? 次報錯
第4次報錯的原因是缺少 net-tools 切換回root用戶安裝它,我極度疑惑第一次是如何啟動成功的 ?
# 切換回root用戶 安裝 net-tools 后用gpadmin用戶 啟動GP
[root@tcloud ~]# yum install net-tools
[gpadmin@tcloud root]$ /usr/local/greenplum-db/bin/gpstart
20210901:10:15:32:010546 gpstart:tcloud:gpadmin-[INFO]:
-Starting gpstart with args:
-Gathering information and validating the environment...
-Greenplum Binary Version: 'postgres (Greenplum Database) 6.13.0 build
commit:4f1adf8e247a9685c19ea02bcaddfdc200937ecd Open Source'
-Greenplum Catalog Version: '301908232'
20210901:10:15:32:010546 gpstart:tcloud:gpadmin-[WARNING]:
-postmaster.pid file exists on Master, checking if recovery startup required
20210901:10:15:32:010546 gpstart:tcloud:gpadmin-[INFO]:
-Commencing recovery startup checks
-No socket connection or lock file in /tmp found for port=2345
-No Master instance process, entering recovery startup mode
-Clearing Master instance pid file
-Starting Master instance in admin mode
-Obtaining Greenplum Master catalog information
-Obtaining Segment details from master...
-Setting new master era
-Commencing forced instance shutdown
-Starting Master instance in admin mode
-Obtaining Greenplum Master catalog information
-Obtaining Segment details from master...
-Setting new master era
-Master Started...
20210901:10:15:34:010546 gpstart:tcloud:gpadmin-[WARNING]:
-One or more hosts are not reachable via SSH.
Any segments on those hosts will be marked down
-Host tcloud is unreachable
-Marking segment 2 down because tcloud is unreachable
20210901:10:15:34:010546 gpstart:tcloud:gpadmin-[CRITICAL]:
-gpstart failed.
(Reason=''NoneType' object has no attribute 'getSegmentHostName'') exiting...
這個時候用Navicat連接資料庫時報 System was started in master-only utility mode - only utility mode connections are allowed 實際上是啟動了 master 但是 由于 Host tcloud is unreachable 導致 segment 資料沒能讀取,

🔥 第 6?? 次成功 🔥
第5次報錯的資訊是 One or more hosts are not reachable via SSH 解決這個問題,
# 運行 gpssh-exkeys -f /home/greenplum/hostfile_exkeys
[gpadmin@tcloud root]$ gpssh-exkeys -f /home/greenplum/hostfile_exkeys
[STEP 1 of 5] create local ID and authorize on local host
... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] retrieving credentials from remote hosts
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
[INFO] completed successfully
# 啟動GP
[gpadmin@tcloud root]$ /usr/local/greenplum-db/bin/gpstart
20210901:10:30:11:014617 gpstart:tcloud:gpadmin-[INFO]:
-Starting gpstart with args:
-Gathering information and validating the environment...
-Greenplum Binary Version: 'postgres (Greenplum Database) 6.13.0 build
commit:4f1adf8e247a9685c19ea02bcaddfdc200937ecd Open Source'
-Greenplum Catalog Version: '301908232'
-Starting Master instance in admin mode
-Obtaining Greenplum Master catalog information
-Obtaining Segment details from master...
-Setting new master era
-Master Started...
Warning: the RSA host key for 'tcloud' differs from the key for the IP address 'xxx.xx.x.x'
Offending key for IP in /home/gpadmin/.ssh/known_hosts:2
Matching host key in /home/gpadmin/.ssh/known_hosts:1
Are you sure you want to continue connecting (yes/no)? yes
20210901:10:30:20:014617 gpstart:tcloud:gpadmin-[INFO]:
-Shutting down master
---------------------------
-Master instance parameters
---------------------------
-Database = template1
-Master Port = 2345
-Master directory = /home/greenplum/gpdata/master/gpseg-1
-Timeout = 600 seconds
-Master standby = Off
---------------------------------------
-Segment instances that will be started
---------------------------------------
- Host Datadir Port
- tcloud /home/greenplum/gpdata/gpnode1/gpseg0 6000
- tcloud /home/greenplum/gpdata/gpnode2/gpseg1 6001
Continue with Greenplum instance startup Yy|Nn (default=N):
> y
20210901:10:30:25:014617 gpstart:tcloud:gpadmin-[INFO]:
-Commencing parallel segment instance startup, please wait...
.
-Process results...
-----------------------------------------------------
- Successful segment starts = 2
- Failed segment starts = 0
- Skipped segment starts (segments are marked down in configuration) = 0
-----------------------------------------------------
-Successfully started 2 of 2 segment instances
-----------------------------------------------------
-Starting Master instance tcloud directory /home/greenplum/gpdata/master/gpseg-1
-Command pg_ctl reports Master tcloud instance active
-Connecting to dbname='template1' connect_timeout=15
-No standby master configured. skipping...
-Database successfully started
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/296841.html
標籤:其他
