|
These steps assume a version of RHEL with a GUI (X11) and an active account with access to the RHEL software repositories. If you are working without a GUI, skip installing PgAdmin and refer to this support article for alternate instructions. If you do not have access to the official RHEL software sources, you can set up a free open source repository from the EPEL team. (this site is not provided or controlled by PTC).
|
|
The steps in this procedure use PostgreSQL version x.x, where x.x is the supported version.
|
|
To install PgAdmin via the command line, reference https://wiki.postgresql.org/wiki/Manual_Setup_at_the_Command_Line.
|
|
The password, which should not be easily guessed or a known, common password, should be at least 14 characters in length and include a mix of uppercase and lowercase letters, numbers, and special characters.
|
|
If the PostgreSQL database is not located on the same server as ThingWorx, then refer to the section Configure PostgreSQL Database Located on a Separate Server than ThingWorx and skip the next two steps. While it is optional to have the PostgreSQL database on the same server as ThingWorx in a development environment, it should be separate in all production environments.
|
|
The following command can be used if you are not using PgAdmin:
sudo -u postgres psql -c "CREATE USER twadmin WITH PASSWORD '<unique postgres password>';"
|
|
This section is optional for development environments, but should be implemented in all production environments.
|
If you want to allow all IPv4 addresses to connect:
|
host all all 0.0.0.0/0 md5
|
If you want to allow only a specific IPv4 address to connect (Replace <ipAddress> with the IP address of the machine making the connection):
|
host all all <ipAddress>/32 md5
|
If you want to allow all IPv6 addresses to connect:
|
host all all ::0/0 md5
|
If you want to allow only a specific IPv6 address to connect (Replace <ipv6Address> with the appropriate address):
|
host all all <ipv6Address>/128 md5
|
|
For additional information about configuring the pg_hba.conf file, see the PostgreSQL documentation.
|
|
After ThingWorx 9.3.1, the ThingworxPostgresqlStorage folder creation or any -l parameter-related steps are no longer required, and the ThingWorx data will be stored at the default location of Postgresql.
|
|
This example uses the x.x.x download from the PTC site. Change the file name to the version you are using.
|
Option
|
Parameter
|
Default
|
Description
|
Example
|
||
---|---|---|---|---|---|---|
t or -T
|
tablespace
|
thingworx
|
Tablespace name
|
-t thingworx
|
||
-p or -P
|
port
|
5432
|
Port number of PostgreSQL
|
-p 5432
|
||
-d or -D
|
database
|
thingworx
|
PostgreSQL Database name to create
|
-d thingworx
|
||
-l or -L
|
tablespace_location
|
/ThingworxPostgresqlStorage
|
Required in ThingWorx 9.3.0 and before. Location in the file system where the files representing database objects are stored. User needs to create this folder manually with permissions before executing the script and then specify the path, for example, -l /ThingworxPostgresqlStorage
|
-l or -L
|
||
-h or -H
|
host
|
localhost
|
Name of the host
|
-h localhost
|
||
-a or -A
|
adminusername
|
postgres
|
Administrator Name
|
-a postgres
|
||
-u or -U
|
thingworxusername
|
twadmin
|
User name that has permissions to write to the database.
|
-u twadmin
|
|
The script can be run with the default parameters as:
$ sudo sh thingworxPostgresSchemaSetup.sh
|
Option
|
Parameter
|
Default
|
Description
|
Example
|
||
---|---|---|---|---|---|---|
-h or -H
|
host
|
localhost
|
IP or host name of the database.
|
-h localhost
|
||
-p or -P
|
port
|
5432
|
Port number of PostgreSQL.
|
-p 5432
|
||
-d or -D
|
database
|
thingworx
|
Database name to use.
|
-d thingworx
|
||
-s or -S
|
schema
|
public
|
Schema name to use.
|
-s myschema
|
||
-u or -U
|
username
|
twadmin
|
Username to update the database schema
|
-u twadmin
|
||
-o or -O
|
option
|
all
|
There are three options:
• all: Sets up the model and data provider schemas into the specified database.
• model: Sets up the model provider schema into the specified database.
• data: Sets up the data provider schema into the specified database.
|
-o data
|
|
The username should match the PostgreSQL username that was previously created.
|
|
If your PostgreSQL server is not the same as your ThingWorx server, and you are having issues with your ThingWorx installation, review your Tomcat logs and platform-settings.json file. The default installation assumes both servers are on the same machine.
|