Starting a Network Server

Clients can connect to a NetworkInterface using the GemFire XD JDBC client driver (URL of the form 'jdbc:gemfirexd://<host>:<port>'). A network listener can be acquired by invoking the startNetworkServer method on a FabricServer instance. GemFire XD uses the Distributed Relational Database Architecture (DRDA) protocol for client-server communication.

Network Server Properties

Specify network server properties when starting a network server on a GemFire XD member. You must specify these properties as system properties:
  • When using the gfxd utility, specify network server properties at the command line when you boot a GemFire XD server.
  • When using the embedded JDBC driver, specify all network server properties in the first JDBC connection to the GemFire XD member.
  • When using the FabricServer API, you can start the FabricServer instance and NetworkListener independently of one another. For example you can start a FabricServer instance, populate tables with initial or default data, and then start a Network Listener at a later time to enable client connections. Include all Network Server properties in the Properties object when you execute the FabricService.startNetworkServer() method.

The FabricServer API promotes properties in the configuration parameter to an equivalent system property if the application does not override them.

Network server startup properties use the prefix 'gemfirexd.drda.' The following properties are available:

gemfirexd.drda.host

gemfirexd.drda.keepAlive

gemfirexd.drda.logConnections

gemfirexd.drda.maxThreads

gemfirexd.drda.minThreads

gemfirexd.drda.portNumber

gemfirexd.drda.securityMechanism

gemfirexd.drda.sslMode

gemfirexd.drda.streamOutBufferSize

gemfirexd.drda.timeSlice

gemfirexd.drda.trace

gemfirexd.drda.traceAll

gemfirexd.drda.traceDirectory

Example

The following sample code shows how to start a Network Listener after specifying several properties.

   import com.pivotal.gemfirexd.*; 

  // start a fabricserver if not running already.
   FabricServer fserver = FabricServiceManager.getFabricServerInstance(); 
   if (fserver.status() != FabricService.State.RUNNING) { 
     Properties props = new Properties(); 
     props.setProperty("mcast-port", "23342"); 
     props.setProperty("conserve-sockets", "false"); 
     props.setProperty("log-level", "fine"); 
     props.setProperty("host-data", "true"); 

     fserver.start(props); 
   } 

  // commonly used network server  properties
   Properties netprops = new Properties(); 
   netprops.setProperty("gemfirexd.drda.minThreads", "10"); 
   netprops.setProperty("gemfirexd.drda.maxThreads", "100"); 
   netprops.setProperty("gemfirexd.drda.keepAlive", "1000"); 
   netprops.setProperty("gemfirexd.drda.sslMode" , "off"); // Other possible values 
                                                         // are "basic" for encryption
                                                         // only with no client
                                                         // authentication, and 
                                                         // "peerAuthentication"
                                                         // for encryption with
                                                         // SSL clients.

   // now start a network server listening on port 4343.
   NetworkInterface netserver = fserver.startNetworkServer("localhost", 4343, netprops); 
 
   System.out.println("started network server properties with \n" +
       netserver.getSysinfo());