IBM Support

How to bind different db2 instances to use different NICs(network interface cards)

Question & Answer


Question

How to bind different db2 instances to use different NICs on one server

Answer

When having multiple db2 instances on a server which has multiple NICs, we may hope to bind different db2 instances to use different NIC. Since V10.5 FP5, we can config it by nicbinding.cfg file(under ~sqllib/cfg directory). Here is the steps:

1. I have 2 NICs on the server (192.168.1.51 + 192.168.1.53)


myhost:~ # ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:B9:A2:3E
inet addr:192.168.1.51 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:feb9:a23e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5986 errors:0 dropped:80 overruns:0 frame:0
TX packets:3626 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:648776 (633.5 Kb) TX bytes:740305 (722.9 Kb)

eth1 Link encap:Ethernet HWaddr 00:50:56:B9:22:97
inet addr:192.168.1.53 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:feb9:2297/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1198 errors:0 dropped:49 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:209777 (204.8 Kb) TX bytes:468 (468.0 b)

2. I have 2 db2 instances db2inst1+db2inst2, and will bind db2inst1 to use 192.168.1.51, db2inst2 to use 192.168.1.53. Both db2inst1 and db2inst2 are use port 50000.

db2inst1@myhost:~/sqllib/cfg> vi nicbinding.cfg
0 192.168.1.51

db2inst1@myhost:~/sqllib/cfg> db2start
06/27/2016 16:54:31 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.

db2inst2@myhost:~/sqllib/cfg> vi nicbinding.cfg
0 192.168.1.53

db2inst2@myhost:~/sqllib/cfg> db2start
06/27/2016 16:54:31 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.

db2inst2@myhost:~/sqllib/cfg> netstat -an | grep 50000
tcp 0 0 192.168.1.53:50000 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.51:50000 0.0.0.0:* LISTEN

Note: after the 2 instances started, we can find port 50000 are listen on the 2 ipaddresses

3. Then use a client to test the connection

db2client@myclient:~> db2 list node directory

Node Directory

Number of entries in the directory = 2

Node 1 entry:

Node name = NODE1
Comment =
Directory entry type = LOCAL
Protocol = TCPIP
Hostname = 192.168.1.51
Service name = 50000

Node 2 entry:

Node name = NODE2
Comment =
Directory entry type = LOCAL
Protocol = TCPIP
Hostname = 192.168.1.53
Service name = 50000

db2client@myclient:~> db2 attach to node1 user db2inst1 using db2inst1

Instance Attachment Information

Instance server = DB2/LINUXX8664 10.5.5
Authorization ID = DB2INST1
Local instance alias = NODE1

db2client@myclient:~> db2 attach to node2 user db2inst2 using db2inst2

Instance Attachment Information

Instance server = DB2/LINUXX8664 10.5.5
Authorization ID = DB2INST2
Local instance alias = NODE2

4. check the port on server

db2inst2@myhost:~> netstat -an | grep 50000
tcp 0 0 192.168.1.53:50000 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.51:50000 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.51:50000 192.168.5.10:54016 ESTABLISHED
tcp 0 0 192.168.1.53:50000 192.168.5.10:53612 ESTABLISHED

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Connectivity - TCP\/IP Protocol","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.5;11.1","Edition":"Advanced Enterprise Server;Enterprise Server","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21986199