Skip to end of metadata
Go to start of metadata

Requires Maven 3.x or later.

Configuring a Multi-instance Storefront across a Geo-Distributed Database

  1. Edit the default.properties file on each host in the NuoDB Domain where you are deploying the Storefront web app to enable the RegionBalancer balancer. This will route connections to the NuoDB Transaction Engines in that broker's region in a round-robin pattern. 

  2. Download the source code from Github.

  3. Create a NuoDB "Storefront" database with "StorefrontUser" as the username and "StorefrontUser" as the password. If you want to change these defaults, edit the nuodb-samples/StorefrontDemo/src/main/resources/hibernate.cfg.xml file or specify overrides using command line arguments described in step 4.
  4. Run the Storefront web app:

    where arguments are:

    ArgumentDescription
    -Dstorefront.url=http://{host}:{port}/{context}

    The externally-accessible URL of the Storefront. Web browsers should be able to access the Storefront web app using this URL. The URL is used by the Storefront front-end for communication and switching among instances. You may use{host}{port}, and {context} fields as placeholders for auto-detected values, or specify a completely custom URL with no placeholders.

    If you do not specify a command line value, the default is pulled from the public-url context param of web.xml. The default is http://{host}:{port}/{context}.

    -Dstorefront.region=Default
    The name of the region in which this Storefront instance is running. If you are using NuoDB 2.0 or greater and don't explicity specify a region name here, the region name is auto-detected by querying the NODES table (GEOREGION column).
    -Dstorefront.db.name=name@host[:port]
    The name, hostname/IP, and port of the NuoDB instance to connect to. If you'd like to run the Storefront with MySQL instead, swap the nuodb-samples/StorefrontDemo/src/main/resources/hibernate.cfg.xml file with nuodb-samples/StorefrontDemo/src/main/resources/hibernate-mysql.cfg.xml and add necessary dependencies to the pom.xml file. The MySQL dependencies already exist in the pom.xml file but need to be uncommented.
    -Dstorefront.db.user=StorefrontUser
    The username of the database account to use when connecting.
    -Dstorefront.db.password=StorefrontUser
    The password of the database account to use when connecting.
    -Dmaven.tomcat.port=8888
    The Maven Tomcat plugin also supports some settings, including the port setting which can be used to simulate multi-regions on a single host (see next section).
  5. Explore the web app at http://localhost:8888/StorefrontDemo (or whichever port you've chosen).

 

Simulating a Multi-Instance Storefront Deployment on a Single Host

  1. Launch the Storefront Demo that shipped with the product.
    This will create the Storefront database and default user and password (StorefrontUser/StorefrontUser) 

     

  2.  Download the source code from Github.

  3. Open three command line terminals and issue the following commands:

    This will run three separate instances of the Storefront Demo on different ports.

  4.  Open a browser to http://localhost:8888/StorefrontDemo to explore the multi-instance Storefront geo-distributed simulation.

 

 

 

 

  • No labels