DEV Community

Michael
Michael

Posted on

Installing GBase 8a When sshd Uses a Non-Default Port

ssh listens on port 22 by default on Linux. If a site changes it to 2222, a plain ssh command still tries 22 and fails. Installing GBase 8a, the China-domestically developed MPP database from GBASE, then needs two separate fixes: one for the shell, one for the cluster's own probes in a gbase deployment.

What the Port Change Breaks

[root@gbase_rh7_003 ~]# grep Port  /etc/ssh/sshd_config
Port 2222
Enter fullscreen mode Exit fullscreen mode

A default connection is refused; -p is mandatory:

[root@gbase_rh7_004 ~]# ssh 10.0.2.103
ssh: connect to host 10.0.2.103 port 22: Connection refused

[root@gbase_rh7_004 ~]# ssh 10.0.2.103 -p 2222
root@10.0.2.103's password:
Enter fullscreen mode Exit fullscreen mode

Set the Port Once in the User-Level ssh Config

The user-level config is ~/.ssh/config, and its permissions can be set to 600:

[gbase@gbase_rh7_003 ~]$ cat /home/gbase/.ssh/config
Host 10.0.2.10?
        port 2222
Enter fullscreen mode Exit fullscreen mode

Known rules for this file:

  • Multiple IPs are supported; each block starts with Host.
  • Wildcards work, such as ? and *.
  • CIDR notation works, e.g. 192.168.1.0/24.
  • IP ranges are not supported — nothing like 100-106.
  • One Host line can list several IPs separated by spaces. If your version does not support that and wildcards do not fit, write one block per IP.

A tested multi-host config:

[gbase@gbase_rh7_003 gcinstall]$ cat ~/.ssh/config
Host 10.0.2.103 10.0.2.104
        port 2222

Host 10.0.2.105
        port 22
Enter fullscreen mode Exit fullscreen mode

With that in place, ssh 10.0.2.103 and ssh 10.0.2.104 go through 2222, while ssh 10.0.2.105 uses 22 — no -p needed.

Install

Because gcware uses ssh to probe whether hosts are online, the installer also needs the port explicitly via sshPort in demo.options; the value is written into gcware.conf:

installPrefix= /opt/gbase
coordinateHost = 10.0.2.103,10.0.2.104
coordinateHostNodeID = 234,235,237
dataHost = 10.0.2.103,10.0.2.104
gcwareHost = 10.0.2.103,10.0.2.104
gcwareHostNodeID = 234,235,237
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase1234'
rootPwd = ''
sshPort = 2222
Enter fullscreen mode Exit fullscreen mode

The install succeeds and gcadmin reports CLUSTER STATE: ACTIVE with 2 coordinators and 2 free data nodes. One small trap: the first gcadmin may return command not found until you run source ~/.gbase_profile.

Confirm the Port gcware Recorded

[root@gbase_rh7_003 ~]# grep ssh_port /opt/gbase/10.0.2.103/gcware/config/gcware.conf
    node_ssh_port: 2222
Enter fullscreen mode Exit fullscreen mode

Going forward, remember there are two places to update, not one: the user-level ~/.ssh/config covers ssh issued by people and scripts, while sshPort covers the online probes the cluster runs itself. Change only one and the install will still stall on port 22 somewhere in the middle of a gbase database setup.

Top comments (0)