【Linux部署】Greenplum数据库6.13.0单机版【重启实录】(5次报错问题及解决的避坑指南+日志文件查看方法)
GP數(shù)據(jù)庫安裝后正常運行,服務(wù)器被惡意連接故修改密碼后重啟,GP數(shù)據(jù)庫也需要重新啟動,這個重新啟動的過程坑坑洼洼 🐾 打印的日志信息進行了處理,刪除了一些冗余。
5次報錯及解決
第 1?? 次報錯
# 服務(wù)器重啟后 啟動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連接數(shù)據(jù)庫時報 System was started in master-only utility mode - only utility mode connections are allowed 實際上是啟動了 master 但是 由于 Host tcloud is unreachable 導(dǎo)致 segment 數(shù)據(jù)沒能讀取。
🔥 第 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/gpstart20210901: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)? yes20210901: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 6001Continue with Greenplum instance startup Yy|Nn (default=N): > y20210901: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匯總重啟腳本:
su gpadmin source /usr/local/greenplum-db/greenplum_path.sh source /home/greenplum/.bashrc source /home/gpadmin/.bash_profile /usr/local/greenplum-db/bin/gpstart日志查看
# gp的日志不是.log結(jié)尾的 是在下邊的路徑下的.csv文件 [gpadmin@tcloud root]$ cd /home/greenplum/gpdata/master/gpseg-1/pg_log # 可以使用 -t 根據(jù)實際進行降序排序 查看最新的日志文件 [gpadmin@tcloud root]$ ll -t總結(jié)
報錯后,如果控制臺有報錯信息,可以根據(jù)報錯信息解決問題,沒有的話就要找報錯日志文件進行查看了。
總結(jié)
以上是生活随笔為你收集整理的【Linux部署】Greenplum数据库6.13.0单机版【重启实录】(5次报错问题及解决的避坑指南+日志文件查看方法)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Linux环境】修改登录提示语(工作小
- 下一篇: 【Linux病毒】阿里云+腾讯云服务器的