A To configure SSH connection without password for root user between two nodes
This section describes how to configure SSH connection without password for root user between two nodes.
In this example, it is considered that DB2 HADR is configured using the host names of the two nodes (Node2 and Node3) as shown in the following db2 command result:
db2 get db cfg for <db2 database name> grep -i hard
In the following output, Node2 and Node3 are the host names of the nodes that are used to configure DB2 HADR.
Database Configuration for Database hadr5 |
| |
Path to log files |
| = |
/mnt/prim_data/hadr5/db2inst5/NODE0000/SQL00001/SQLOGDIR/ |
| |
HADR database role |
| = PRIMARY |
HADR local host name | (HADR_LOCAL_HOST) | = Node2 |
HADR local service name | (HADR_LOCAL_SVC) | = 41065 |
HADR remote host name | (HADR_REMOTE_HOST) | = Node3 |
HADR remote service name | (HADR_REMOTE_SVC) | = 41064 |
HADR instance name of remote server | (HADR_REMOTE_INST) | = db2inst5 |
HADR timeout value | (HADR_TIMEOUT) | = 120 |
HADR log write synchronization mode | (HADR_SYNCMODE) | = NEARSYNC |
HADR peer window duration (seconds) | (HADR_PEER_WINDOW) | = 0 |
To configure SSH connection without password between Node2 and Node3, use the following commands. Ensure that .ssh directory exists on both the nodes in the root’s home directory. Otherwise, create this directory using the command: mkdir /.ssh
NOTE: All commands are executed as root user.
On Node Node3
Generate the RSA and DSA keys on Node3.
Node3# /usr/bin/ssh-keygen -t rsa
At the prompts:
1.Accept the default location for the key file.
2.Do not enter any password here when asked for a pass phrase. Leave it empty.
Node3# /usr/bin/ssh-keygen -t dsa
At the prompts:
1.Accept the default location for the key file.
2.Do not enter any password here when asked for a pass phrase. Leave it empty.
On Node Node2
Node2# /usr/bin/ssh-keygen -t rsa
At the prompts:
1.Accept the default location for the key file.
2.Do not enter any password here when asked for a pass phrase. Leave it empty.
Node2# /usr/bin/ssh-keygen -t dsa
At the prompts:
1.Accept the default location for the key file.
2.Do not enter any password here when asked for a pass phrase. Leave it empty.
Generate authorization keys and known hosts:
Node2# touch /.ssh/authorized_keys
Node2# cd /.ssh
NOTE: Provide root user’s password for the following four commands.
Node2# ssh Node2 cat /.ssh/id_rsa.pub >> /.ssh/authorized_keys Node2# ssh Node2 cat /.ssh/id_dsa.pub >> /.ssh/authorized_keys
49