CentOS7的不同ssh端口使用Greenplum的gpinitsystem命令时仍然连接22个ssh端口

发布于 2025-01-11 17:14:08 字数 3624 浏览 0 评论 0原文

我想在 CentOS7.9 中安装 Greenplum,将默认 ssh 端口更改为 10022。我更改了“gpssh-exkeys”脚本,为所有 ssh 命令添加“-p 10022”,并为所有 scp 命令添加“-P 10022” 。然后运行就ok了。 然后我更改了 '/usr/local/greenplum-db/lib/python/gppylib/commands/base.py' 脚本以在 ssh 命令行中添加 '-p 10022' 。

        # Escape " for remote execution otherwise it interferes with ssh
        cmd.cmdStr = cmd.cmdStr.replace('"', '\\"')
        cmd.cmdStr = "ssh -p 10022 -o StrictHostKeyChecking=no -o ServerAliveInterval=60 " \
                     "{targethost} \"{gphome} {cmdstr}\"".format(targethost=self.targetHost,
                                                                 gphome=". %s/greenplum_path.sh;" % self.gphome,
                                                                 cmdstr=cmd.cmdStr)

但我收到了运行“gpinitsystem”时仍然尝试连接端口 22 的错误。

[gpadmin@mdw ~]$ gpinitsystem -c /home/gpadmin/gpinitsystem_config --locale=zh_CN -h /home/gpadmin/seg_hosts
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Reading Greenplum configuration file /home/gpadmin/gpinitsystem_config
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, Completed
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
.ssh: connect to host sdw1 port 22: Connection refused
.ssh: connect to host sdw2 port 22: Connection refused

20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Configuring build for multi-home array
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 630: ((: REMAINDER=2 % 0: division by 0 (error token is "0")
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 631: ((: MULTIPLE=2 / 0: division by 0 (error token is "0")
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 632: [: -ne: unary operator expected
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 632: [: -eq: unary operator expected
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 640: [: -gt: unary operator expected
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Building primary segment instance array, please wait...

20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Building group mirror array type , please wait...

20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking Master host
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, please wait...
ssh: connect to host sdw1 port 22: Connection refused
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 704: [: -eq: unary operator expected
ssh: connect to host mdw port 22: Connection refused
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 732: [: -lt: unary operator expected
ssh: connect to host mdw port 22: Connection refused
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[WARN]:-Postgres version does not match. [postgres (Greenplum Database) 6.19.3 build commit:33e10eef63ae25aeb33afbefdda46b6367353800 Open Source != ]
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-Postgres version does not match Script Exiting!

我没有找到官方文档 https://docs.greenplum.org/ 来指导如何操作使用不同的 ssh 端口进行安装。

谢谢你!

I want to install Greenplum in CentOS7.9 which is changed default ssh port to 10022. I changed 'gpssh-exkeys' script to add '-p 10022' for all of ssh command and add '-P 10022' for all of scp command. And run it is ok.
Then I changed '/usr/local/greenplum-db/lib/python/gppylib/commands/base.py' script to add '-p 10022' in a ssh command line.

        # Escape " for remote execution otherwise it interferes with ssh
        cmd.cmdStr = cmd.cmdStr.replace('"', '\\"')
        cmd.cmdStr = "ssh -p 10022 -o StrictHostKeyChecking=no -o ServerAliveInterval=60 " \
                     "{targethost} \"{gphome} {cmdstr}\"".format(targethost=self.targetHost,
                                                                 gphome=". %s/greenplum_path.sh;" % self.gphome,
                                                                 cmdstr=cmd.cmdStr)

But I got the error that present still try to connent port 22 when run 'gpinitsystem'.

[gpadmin@mdw ~]$ gpinitsystem -c /home/gpadmin/gpinitsystem_config --locale=zh_CN -h /home/gpadmin/seg_hosts
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Reading Greenplum configuration file /home/gpadmin/gpinitsystem_config
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, Completed
20220303:21:55:40:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
.ssh: connect to host sdw1 port 22: Connection refused
.ssh: connect to host sdw2 port 22: Connection refused

20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Configuring build for multi-home array
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 630: ((: REMAINDER=2 % 0: division by 0 (error token is "0")
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 631: ((: MULTIPLE=2 / 0: division by 0 (error token is "0")
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 632: [: -ne: unary operator expected
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 632: [: -eq: unary operator expected
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 640: [: -gt: unary operator expected
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Building primary segment instance array, please wait...

20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Building group mirror array type , please wait...

20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking Master host
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, please wait...
ssh: connect to host sdw1 port 22: Connection refused
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 704: [: -eq: unary operator expected
ssh: connect to host mdw port 22: Connection refused
/usr/local/greenplum-db-6.19.3/bin/gpinitsystem: line 732: [: -lt: unary operator expected
ssh: connect to host mdw port 22: Connection refused
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-[WARN]:-Postgres version does not match. [postgres (Greenplum Database) 6.19.3 build commit:33e10eef63ae25aeb33afbefdda46b6367353800 Open Source != ]
20220303:21:55:41:005293 gpinitsystem:mdw:gpadmin-Postgres version does not match Script Exiting!

And I didn't find official documents, https://docs.greenplum.org/, for guiding how to install withing the different ssh port.

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

安人多梦 2025-01-18 17:14:08

请勿修改交付的实用程序。建议利用 ~gpadmin/.ssh/config 为您的主机指定端口。所有 Greenplum 实用程序都应遵循该文件中的设置。

示例 ~gpadmin/.ssh/config,其中所有主机都称为 sdw1-pri、sdw2-pri 等:

Host sdw*-pri
    Port 10022

Do not modify delivered utilities. Recommend leveraging ~gpadmin/.ssh/config specifying Port for your hosts. All Greenplum utilities should honor settings in that file.

Example ~gpadmin/.ssh/config where all hosts are known as sdw1-pri, sdw2-pri and so on:

Host sdw*-pri
    Port 10022
酒绊 2025-01-18 17:14:08

您可以在 /etc/sshd_config 中指定 10022 端口并重试吗?

Can you specify the 10022 port in /etc/sshd_config and try again.

自演自醉 2025-01-18 17:14:08

gpinitsystem 内部调用 REMOTE_EXECUTE_AND_GET_OUTPUT 函数,该函数是/bin/lib/gp_bash_functions.sh 文件的一部分。

目前 gp_bash_functions.sh 有以下条目。

SSH=`findCmdInPath ssh`
if [ x"$TRUSTED_SHELL" = x"" ]; then TRUSTED_SHELL="$SSH"; fi

我认为您可能需要更改 if 条件,如下所示

if [ x"$TRUSTED_SHELL" = x"" ]; then TRUSTED_SHELL="$SSH -p 10022"; fi

gpinitsystem internally calling REMOTE_EXECUTE_AND_GET_OUTPUT function which is part of <install_dir>/bin/lib/gp_bash_functions.sh file.

Currently gp_bash_functions.sh has below entries.

SSH=`findCmdInPath ssh`
if [ x"$TRUSTED_SHELL" = x"" ]; then TRUSTED_SHELL="$SSH"; fi

I think you may need to change the if condition like below

if [ x"$TRUSTED_SHELL" = x"" ]; then TRUSTED_SHELL="$SSH -p 10022"; fi
愛放△進行李 2025-01-18 17:14:08

谢谢格雷格·斯皮格尔伯格。显示我的〜gpadmin / .ssh / config:

Host    mdw
        HostName        mdw
        Port    10022

Host    smdw
        HostName        smdw
        Port    10022

Host    sdw1
        HostName        sdw1
        Port    10022

Host    sdw2
        HostName        sdw2
        Port    10022

ssh配置的优先级:命令>的指定参数.ssh/config > /etc/ssh/ssh_config

Thank you Greg Spiegelberg. Show my ~gpadmin/.ssh/config:

Host    mdw
        HostName        mdw
        Port    10022

Host    smdw
        HostName        smdw
        Port    10022

Host    sdw1
        HostName        sdw1
        Port    10022

Host    sdw2
        HostName        sdw2
        Port    10022

Priority of ssh config: specified parameter for command > .ssh/config > /etc/ssh/ssh_config

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文