Postgres-xl初始化报错gtm_ctl、initgtm、initdb 、pg_ctl 等not found

在Ubuntu 16.04 环境下,部署Postgres-xl,在执行$pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf init all 初始化集群过程中,提示gtm_ctl、initgtm、initdb 、pg_ctl 等not found,导致初始化失败,数据库无法启动的问题。

网上提供的常规解决方法如下:

在Postgres用户的home目录下.bashrc文件中添加如下环境变量:

export PGHOME=/home/postgres/pgxl
export PGUSER=postgres
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH
export PATH=$PGHOME/bin:$PATH

并验证其是否生效:1、正常打印$PGHOME   2、Path变量中是否包含$PGHOME/bin的路径  3、 进入pgxc_ctl端,手动执行gtm_ctl并不会提示not found错误    4、多节点环境下,要保证每个节点均已添加以上环境变量。

但是在执行完以上检查后,依旧会提示如上错误 ~蒙逼脸~,最后使用了如下方式解决该问题:

$Path初始变量中包含了一个系统目录/usr/local/bin/,检查该目录默认为空,将$PGHOME/bin/目录下所有文件均link到该目录下,并修改其文件所有者为Postgres,后再次进行初始化操作即可(多个节点时,各节点均需如此操作).

root@qcserver1:/usr/local/bin# ln -s /home/postgres/pgxl/bin/* ./
root@qcserver1:/usr/local/bin# chown -R postgres:postgres ./*
root@qcserver1:/usr/local/bin# ll
总用量 8
drwxr-xr-x  2 root     root     4096 11月 19 15:24 ./
drwxr-xr-x 10 root     root     4096 4月  21  2016 ../
lrwxrwxrwx  1 postgres postgres   33 11月 19 15:24 clusterdb -> /home/postgres/pgxl/bin/clusterdb*
lrwxrwxrwx  1 postgres postgres   40 11月 19 15:24 coordExtraConfig -> /home/postgres/pgxl/bin/coordExtraConfig
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 createdb -> /home/postgres/pgxl/bin/createdb*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 createuser -> /home/postgres/pgxl/bin/createuser*
lrwxrwxrwx  1 postgres postgres   30 11月 19 15:24 dropdb -> /home/postgres/pgxl/bin/dropdb*
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 dropuser -> /home/postgres/pgxl/bin/dropuser*
lrwxrwxrwx  1 postgres postgres   28 11月 19 15:24 ecpg -> /home/postgres/pgxl/bin/ecpg*
lrwxrwxrwx  1 postgres postgres   27 11月 19 15:24 gtm -> /home/postgres/pgxl/bin/gtm*
lrwxrwxrwx  1 postgres postgres   31 11月 19 15:24 gtm_ctl -> /home/postgres/pgxl/bin/gtm_ctl*
lrwxrwxrwx  1 postgres postgres   33 11月 19 15:24 gtm_proxy -> /home/postgres/pgxl/bin/gtm_proxy*
lrwxrwxrwx  1 postgres postgres   30 11月 19 15:24 initdb -> /home/postgres/pgxl/bin/initdb*
lrwxrwxrwx  1 postgres postgres   31 11月 19 15:24 initgtm -> /home/postgres/pgxl/bin/initgtm*
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 oid2name -> /home/postgres/pgxl/bin/oid2name*
lrwxrwxrwx  1 postgres postgres   41 11月 19 15:24 pg_archivecleanup -> /home/postgres/pgxl/bin/pg_archivecleanup*
lrwxrwxrwx  1 postgres postgres   37 11月 19 15:24 pg_basebackup -> /home/postgres/pgxl/bin/pg_basebackup*
lrwxrwxrwx  1 postgres postgres   31 11月 19 15:24 pgbench -> /home/postgres/pgxl/bin/pgbench*
lrwxrwxrwx  1 postgres postgres   33 11月 19 15:24 pg_config -> /home/postgres/pgxl/bin/pg_config*
lrwxrwxrwx  1 postgres postgres   38 11月 19 15:24 pg_controldata -> /home/postgres/pgxl/bin/pg_controldata*
lrwxrwxrwx  1 postgres postgres   30 11月 19 15:24 pg_ctl -> /home/postgres/pgxl/bin/pg_ctl*
lrwxrwxrwx  1 postgres postgres   31 11月 19 15:24 pg_dump -> /home/postgres/pgxl/bin/pg_dump*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pg_dumpall -> /home/postgres/pgxl/bin/pg_dumpall*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pg_isready -> /home/postgres/pgxl/bin/pg_isready*
lrwxrwxrwx  1 postgres postgres   37 11月 19 15:24 pg_receivewal -> /home/postgres/pgxl/bin/pg_receivewal*
lrwxrwxrwx  1 postgres postgres   38 11月 19 15:24 pg_recvlogical -> /home/postgres/pgxl/bin/pg_recvlogical*
lrwxrwxrwx  1 postgres postgres   35 11月 19 15:24 pg_resetwal -> /home/postgres/pgxl/bin/pg_resetwal*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pg_restore -> /home/postgres/pgxl/bin/pg_restore*
lrwxrwxrwx  1 postgres postgres   33 11月 19 15:24 pg_rewind -> /home/postgres/pgxl/bin/pg_rewind*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pg_standby -> /home/postgres/pgxl/bin/pg_standby*
lrwxrwxrwx  1 postgres postgres   37 11月 19 15:24 pg_test_fsync -> /home/postgres/pgxl/bin/pg_test_fsync*
lrwxrwxrwx  1 postgres postgres   38 11月 19 15:24 pg_test_timing -> /home/postgres/pgxl/bin/pg_test_timing*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pg_upgrade -> /home/postgres/pgxl/bin/pg_upgrade*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pg_waldump -> /home/postgres/pgxl/bin/pg_waldump*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 pgxc_clean -> /home/postgres/pgxl/bin/pgxc_clean*
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 pgxc_ctl -> /home/postgres/pgxl/bin/pgxc_ctl*
lrwxrwxrwx  1 postgres postgres   36 11月 19 15:24 pgxc_monitor -> /home/postgres/pgxl/bin/pgxc_monitor*
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 postgres -> /home/postgres/pgxl/bin/postgres*
lrwxrwxrwx  1 postgres postgres   34 11月 19 15:24 postmaster -> /home/postgres/pgxl/bin/postmaster*
lrwxrwxrwx  1 postgres postgres   28 11月 19 15:24 psql -> /home/postgres/pgxl/bin/psql*
lrwxrwxrwx  1 postgres postgres   33 11月 19 15:24 reindexdb -> /home/postgres/pgxl/bin/reindexdb*
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 vacuumdb -> /home/postgres/pgxl/bin/vacuumdb*
lrwxrwxrwx  1 postgres postgres   32 11月 19 15:24 vacuumlo -> /home/postgres/pgxl/bin/vacuumlo*

至于,为什么$PGHOME环境变量添加成功,在pgxc_ctl端都可以正常识别,但是在初始化过程中无法识别的问题,至今无法理解 ~无奈脸~。只能通过以上非常规方法解决~

 

 

 

 

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值