Results 1 to 3 of 3

Thread: client affinity

  1. #1
    Join Date
    Feb 2004
    Location
    earth
    Posts
    96

    Smile Unanswered: client affinity

    Hello DB2 guru,

    I am looking at alternative way instead of using Automated Client Reroute in DB2 10.5 hadr, I am trying to work out something out of client affinity with auxiliary standby database.

    Let say, if i have server1, server2 and server3 and a client1 computer as client. I have updated db2dsdriver.cfg as below here from the IBM information center link
    IBM Knowledge Center

    <database name="SAMPLE" host="s1.net.com" port="50001">
    <acr>
    <parameter name="enableAcr" value="true"/>
    <parameter name="maxAcrRetries" value="1"/>
    <parameter name="acrRetryInterval" value="2"/>
    <alternateserverlist>
    <server name="server1"
    hostname="s1.net.com"
    port="50001">
    </server>
    <server name="server2"
    hostname="s2.net.com"
    port="50001">
    </server>
    <server name="server3"
    hostname="s3.net.com"
    port="50001">
    </server>
    </alternateserverlist>
    <affinitylist>
    <list name="list1" serverorder="server1,server2,server3">
    </list>
    <list name="list2" serverorder="server3,server2,server1">
    </list>
    </affinitylist>
    <clientaffinitydefined>
    <!- this section has specific defined affinities -->
    <client name="client1"
    hostname="client1.net.com"
    listname="list2">
    </client>
    <client name="client2"
    hostname="client1.net.com"
    listname="list1">
    </client>
    </clientaffinitydefined>
    <clientaffinityroundrobin>
    <client name="client3" hostname="client1.net.com">
    <!- This entry is index 0. The number of servers is 3.
    0 mod 3 is 0, so the first that is tried
    during automatic client reroute is the server whose
    index in <alternateserverlist> is 0 (server1).
    The next server has index 1 mod 3, which is 1
    (server2). The final server has index 2 mod 3,
    which is 2 (server3). -->
    </client>
    <client name="client4" hostname="client1.net.com">
    <!- This entry is index 1. The number of servers is 3.
    1 mod 3 is 1, so the first that is tried
    during automatic client reroute is the server whose
    index in <alternateserverlist> is 1 (server2).
    The next server has index 2 mod 3, which is 2
    (server3). The final server has index 3 mod 3,
    which is 0 (server1). -->
    </client>
    </clientaffinityroundrobin>
    </acr>
    </database>

    I name the above as db2dsdriver.cfg and copy over to /opt/ibm/db2/V10.5/cfg folder.
    My application is using IBM_DB2 php driver to access DB2 10.5 primary server1 database.

    When I shutdown primary server1 running db2stop force, Automated Client Reroute (ACR) will route my application to server2, however when I shutdown server2 db2stop force, it did not route to server3.

    Do I miss other step to configure it to work with db2dsdriver.cfg?

    Thank you

  2. #2
    Join Date
    Feb 2004
    Location
    earth
    Posts
    96
    I have run db2cli validation to check the db2dsdriver.cfg file located in /home/db2inst1/sqllib/cfg with the following configuration:

    <configuration>
    <databases>
    <database name="sample" host="server1.net.com" port="50001">
    <acr>
    <parameter name="enableACR" value="true"/>
    <alternateserverlist>
    <server name="server1" hostname="server1.net.com" port="50001">
    </server>
    <server name="server2" hostname="server2.net.com" port="50001">
    </server>
    <server name="server3" hostname="server3.net.com" port="50001">
    </server>
    </alternateserverlist>
    <affinitylist>
    <list name="A1" serverorder="server1,server2,server3" />
    <list name="A2" serverorder="server3,server2,server1" />
    </affinitylist>
    <clientaffinitydefined>
    <client name="clientHost1" hostname="client.net.com" listname="A1" />
    <client name="clientHost2" hostname="client.net.com" listname="A2" />
    </clientaffinitydefined>
    <clientaffinityroundrobin>
    <client name="clientHost3" hostname="client.net.com">
    </client>
    <client name="clientHost4" hostname="client.net.com">
    </client>
    </clientaffinityroundrobin>
    </acr>
    </database>
    </databases>
    </configuration>

    I can ping from client.net.com to server1,seerver2 and server3 with no problem and issue a db2 connect to server1 and run a query on to select some data from employee table in sample database.

    Server1, Server2 and Server3 are setup as DB2HADR,where Server1 is Primary, Server2 is Principal Standby and Server3 is Auxiliary Standby. I try to shutdown Server1 which allow Automated Client Reroute to reroute the client application to Server2, but when I shutdown Server2, client affinity did not reroute according to the affinitylist server by order.
    Do I miss out anything in the setup?

    Thanks in advance.

  3. #3
    Join Date
    Feb 2004
    Location
    earth
    Posts
    96
    The result of db2cli validation show as below on db2dsdriver.cfg:

    db2inst1@client:~/sqllib/cfg> db2cli validate

    ================================================== =============================
    Client information for the current copy:
    ================================================== =============================

    Client Package Type : IBM Data Server Runtime Client
    Client Version (level/bit): DB2 v10.5.0.3 (s140513/32-bit)
    Client Platform : Linux
    Install/Instance Path : /opt/ibm/db2/V10.5
    DB2DSDRIVER_CFG_PATH value: <not-set>
    db2dsdriver.cfg Path : /home/db2inst1/sqllib/cfg/db2dsdriver.cfg
    DB2CLIINIPATH value : <not-set>
    db2cli.ini Path : /home/db2inst1/sqllib/cfg/db2cli.ini
    db2diag.log Path : /home/db2inst1/sqllib/db2dump/db2diag.log

    ================================================== =============================
    db2dsdriver.cfg schema validation for the entire file:
    ================================================== =============================

    Success: The schema validation completed successfully without any errors.

    ================================================== =============================
    The validation is completed.
    ================================================== =============================

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •