Menu

Using different servers in same cluster config file

Help
newbie0322
2014-07-16
2014-07-18
  • newbie0322

    newbie0322 - 2014-07-16

    Our current scenario is that we have 10 tomcat web tiers and 2 servers in production. We want to have ha-jdbc on all tomcat web tiers and let ha-jdbc manage the load balancing. In Test environment, I have one instance of tomcat running and using two servers. The issue is when the servers are in the same physical location, the cluster works fine (fail over and load balancing).However when the servers are in different location, the fail over fails.
    I get this error: Could not find server 'server2' in sys.servers. Verify that the correct server name was specified.

    <ha-jdbc xmlns="urn:ha-jdbc:cluster:3.0">
    <sync id="passive"/>
    <state id="simple"/>
    <cluster balancer="round-robin"
     dialect="standard" default-sync="passive" transaction-mode="parallel"   
     durability="none" meta-data-cache="lazy">
    <database id="db1" location="com.inet.tds.PDataSource">
         <user>user</user>
         <password>pass</password>
         <property name="serverName">abc</property>
         <property name="portNumber">121</property>
         <property name="databaseName">dbname</property>
    </database>
    <database id="db2" location="com.inet.tds.PDataSource">
         <user></user>
         <password></password>
         <property name="serverName">server2</property>
         <property name="portNumber"></property>
         <property name="databaseName"</property>
    </database>
    </cluster>
    </ha-jdbc>
    

    I am pretty new to this stuff,any help is really appreciated.

     
  • Paul Ferraro

    Paul Ferraro - 2014-07-18

    It looks like your definition for db2 is missing a databaseName and portNumber.

     
  • newbie0322

    newbie0322 - 2014-07-18

    Thats just a copy paste error. In our actual file we have everything specified and still get the same error.

     
  • Paul Ferraro

    Paul Ferraro - 2014-07-18

    Can you paste the stacktrace of the exception? I'm not familiar with this jdbc driver.

     
  • newbie0322

    newbie0322 - 2014-07-18

    Caused by: com.inet.tds.Tds4SQLException: Msg 7202, Level 11, State 2, Line 1, Sqlstate 01000
    [SERVER1]Could not find server 'SERVER2' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
    at com.inet.tds.aa.a(Unknown Source)
    at com.inet.tds.n.b(Unknown Source)
    at com.inet.tds.n.a(Unknown Source)
    at com.inet.tds.p.c(Unknown Source)
    at com.inet.tds.p.a(Unknown Source)
    at com.inet.tds.p.b(Unknown Source)
    at com.inet.tds.bg.g(Unknown Source)
    at com.inet.tds.bg.executeQuery(Unknown Source)
    at com.inet.pool.u.executeQuery(Unknown Source)
    at com.inet.pool.ac.executeQuery(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.sf.hajdbc.util.reflect.Methods.invoke(Methods.java:49)
    at net.sf.hajdbc.invocation.SimpleInvoker.invoke(SimpleInvoker.java:53)
    at net.sf.hajdbc.balancer.AbstractSetBalancer.invoke(AbstractSetBalancer.java:77)
    at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:80)
    at net.sf.hajdbc.invocation.InvocationStrategies.invoke(InvocationStrategies.java:35)
    at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:95)
    at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:85)
    at net.sf.hajdbc.sql.ChildInvocationHandler.invoke(ChildInvocationHandler.java:44)
    at com.sun.proxy.$Proxy84.executeQuery(Unknown Source)

     

Log in to post a comment.