How to set up a second Persistence Provider

    • All of the entities and data in storage entities(Stream, ValueStream, DataTable, Wiki, Blog) are kept in Persistence Provider, to enhance the storage volume of Thingworx, it is advised to use bigger Persistence Provider (PostgreSQL or Cassandra rather than Neo4j and H2), move and keep certain part of data in external database or set up a second Persistence Provider
    • Data Storage entities (Stream, ValueStream, DataTable) and Collaboration entities (Wiki, Blog) can be assigned to the new Persistence Provider to keep the Business Data
    • The original Persistence Provider (upon installation) will be freed from large data input and respond faster, and only holds the Model Data (entity information)
    • Small Persistence Provider like H2 or Neo4j, which does not require extra steps to setup in the Thingworx installation process, cannot set up a second Persistence Provider (they don't have .bat files to configure the database)

     

    • Here is an example for setting up a second PostgreSQL (may also applicable for Cassandra)
      • Install a new PostgreSQL in the server
        • Should give different folder names for the files, or two PostgreSQL will affect each other
        • PostgreSQL 9.5 could work with Thingworx 7.2.x, but cannot be used with 7.3 and above. Version 9.5 is not officially supported or advised by now, and the user should take their own risk if doing so.
        • The new PostgreSQL will have a new port number (e.g. first port is 5432, the new port is 5433)
      • Open PostgreSQL using pgAdmin 3
        • Create a new user role:
          a. Right click PostgreSQL9.4 (localhost:5433).
          b. Select NewObject>New Login Role. On the Properties tab, in the Role name field, enter the user role name.
          c. On the Definition tab, in the Password field, enter a unique password (you will be prompted to enter it twice).
      • Add the new <postgres-installation>/bin folder to system path variable
      • Edit the thingworxPostgresDBSetup.bat and thingworxPostgresSchemaSetup.bat from the Thingworx software download package, and change the port property to 5433

    User-added image

      • Execute the two scripts, and new database and tablesapce will be created

    User-added image

      • platform-settings.json file does not need extra configuration
      • Restart the Tomcat server, a new folder will be created under ThingworxPostgresqlStorage folderUser-added image
      • Go to Thingworx composer, create a new Persistence Provider in the Home list
        • Give it a new name, and select Persistence Provider Package(only one choice)
        • After selection, a Configuration field will show up in the ENTITY INFORMATION field ( such field will not appear in Neo4j based Thingworx)
        • Open Configuration and change the JDBC URL to jdbc:postgresql://localhost:5433/thingworx, update Password, click Save

      • The new Persistence Provider can be used in data storage entities nowUser-added image
      • The new Persistence Provider can also be set as default provider