Usage of PostgreSQL on Windows๐Ÿ”—

PostgreSQL on Windows OS is installed automatically along with the components of Eocortex.

Note

The most up-to-date version of Eocortex can be downloaded from the eocortex.com website at the Support / Software Installation Packages Supported page.

Note

During installation, a DBMS user named postgres with the password masterkey will be created automatically.

Depending on the version of Eocortex, the PostgreSQL version and the automatic installation processes for PostgreSQL differ:

  • In Eocortex 4.6 and above, PostgreSQL 16 is installed (for all internal databases).

  • In Eocortex 4.0-4.5, PostgreSQL 12 is installed (for all internal databases).

  • In Eocortex 3.4โ€“3.6, PostgreSQL 11 is installed (to store events from the Search for Objects module).

Scan for PostgreSQL on a computer๐Ÿ”—

During the automatic installation process, the server Eocortex is checked for the required version of PostgreSQL: if this version is not installed, during the installation process Eocortex it will be suggested to install the required version of PostgreSQL.

Installation and update of PostgreSQL for Eocortex 3.4-3.6๐Ÿ”—

Eocortex versions 3.4-3.6 require PostgreSQL version 11 to store Search for Objects module events. All other events and modules use Firebird.

The following is a description of PostgreSQL installation in automatic mode, performed during the installation of other Eocortex components:

  1. Install Eocortex Server or Eocortex Standalone to a computer. If Eocortex Server or Eocortex Standalone is already installed, move to the next step.

  2. Stop Eocortex operation. For Eocortex Server, this can be done using the Eocortex Eocortex Status Info utility or in the Windows Services management snap-in. For Eocortex Standalone, this can be done via the context menu of the application icon in the taskbar.

  3. Run the Eocortex Eocortex Neural Networks Standard installation package of the version corresponding to the installed Eocortex instance.

  4. In the list of analytics to install, select the Search for Objects module and click Next.

  5. If PostgreSQL is not installed or has a lower version than required, a window prompting to install the required version of PostgreSQL will open. Confirm installation; change the installation path if necessary. Click Next.

  6. Proceed according to the instructions of the Installation Wizard.

  7. Restore Eocortex operation.

Installation and update of PostgreSQL for Eocortex 4.0 and higher๐Ÿ”—

Eocortex versions 4.0-4.4 require PostgreSQL version 12 to store all internal databases.

Since version 4.6, PostgreSQL 16 is used as the database for the Eocortex Server application.

Warning

When updating the Eocortex server to version 4.6, all data from PostgreSQL 12 is automatically migrated to PostgreSQL 16.

Warning

For a successful update, ensure that there is at least twice as much free space available on the drive as the current size of the PostgreSQL 12 database. To find out how much free space is available on the drive, use the psql utility by running the command:

\l+

Warning

In Eocortex version 4.6 and higher, when updating via Centralized server update, PostgreSQL is only installed if it is not already present on the servers.

The following is a description of PostgreSQL installation in automatic mode, performed during the installation of other Eocortex components:

  1. Install Eocortex Server or Eocortex Standalone to a computer. If Eocortex Server or Eocortex Standalone is already installed, move to the next step.

  2. If PostgreSQL is not installed or has a lower version than required, a window prompting to install the required version of PostgreSQL will open. Confirm installation; change the installation path if necessary. Click Next.

  3. Proceed according to the instructions of the Installation Wizard.

Warning

If any settings (password, port, pg_hba.conf, etc.) were changed manually before updating to PostgreSQL 16, these settings will need to be configured again after the update is complete.

Database setup for event recording๐Ÿ”—

Due to the fact that this improvement does not provide any new features for users in terms of using Eocortex, using the PostgreSQL database does not require any additional settings other than the already existing database event recording settings. To start writing events to the system database:

  1. Run the Eocortex Configurator application and go to the Servers page.

  2. Select a server in the list.

  3. Select the Information tab on the right part of the window and click Configure.

  4. In the window that opens, select the Archive tab and set for one of available drives the Archive + database or Database only role.

  5. Apply settings.

Warning

Additional PostgreSQL configuration is required if the system uses remote databases for the Face Recognition or License Plate Recognition modules. See the Analytics modules databases section.

Warning

By default, the 5432 port is used for Eocortex and PostgreSQL. This port must not be used by other applications, otherwise event logging and database operations will not be performed.

Change of default user password๐Ÿ”—

If the default postgres user created during installation is used, but it is necessary to use a custom password, follow these steps:

Warning

All the following steps must be made directly on the server for which the changes are being made.

  1. Stop Eocortex operation. For Eocortex Server, this can be done using the Eocortex Eocortex Status Info utility or in the Windows Services management snap-in. For Eocortex Standalone, this can be done via the context menu of the application icon in the taskbar.

  2. Launch the psql utility as a DBMS user. To do this, run the command line, go to the directory with the utility (Default: C:\Program Files\PostgreSQL\bin) and run the command:

    psql -U postgres
    
  3. Input the current password to confirm the login (Default: masterkey).

  4. Change the password with the command:

    ALTER ROLE postgres WITH PASSWORD 'newPassword';
    

    where newPassword is a new password for postgres user.

  5. Open the C:\ProgramData\EocortexServerConfig directory and edit the ArchiveSystem.xml configuration file with any text editor.

  6. Find the PostgreSqlConfig section and edit User and Password lines according to new DBMS user credentials.

    The following is an example of such settings:

    <PostgreSqlConfig>
        <Ip>127.0.0.1</Ip>
        <Port>5432</Port>
        <User>postgres</User>
        <Password>newPassword</Password>
    </PostgreSqlConfig>
    
  7. To allow the system making backups of database files, make sure that new credentials are added to the DBMS password file. To do this, go to the C:\Users\[UserName]\AppData\Roaming\postgresql directory and edit the pgpass.conf file with any text editor. Check that the selected user has access to the Eocortex database files.

  8. Restore Eocortex operation.

Analytics modules databases๐Ÿ”—

If the Face Recognition or License Plate Recognition modules are used in the system, the DBMS user editing will affect their bases as well.

If the Local Database is used, Eocortex will use the name and password specified in the ArchiveSystem.xml file to access the database.

If the Remote Database is used, changing the PostgreSQL credentials on the server storing the database will require a new name and password to be entered in the settings of all cameras that use the database.

Note

Use case:

Server 1 hosts the face database.

Server 2 hosts a number of cameras that use the face database from Server 1.

Modifying the DBMS user on Server 2 will not affect access to the face database hosted on Server 1.

Modifying the DBMS user on Server 1 will require new data to be specified for all cameras on Server 2 that use the face database hosted on Server 1.

Warning

Remote access to databases is not allowed by default in PostgreSQL and must be additionally configured if remote databases are used for analytics.

The steps below must be performed directly on the server hosting the database of the module.

  1. Go to the directory with the PostgreSQL configuration files.

    Default path:

    C:\ProgramData\postgre16\
    
  2. Edit the file postgresql.conf with any text editor and add a line like the following:

    listen_addresses = '*'
    

    The specified example allows receiving requests to databases from all available network adapters of the server. If it is necessary to limit the list of adapters allowed to receive requests, replace the /* symbol with the exact address of the network adapter.

    Note

    More details about this setting can be found in the PostgreSQL 16 documentation (see Connections and Authentication).

  3. Edit the file pg_hba.conf with any text editor and add a line like the following:

    host all all 192.168.0.0/24 md5
    

    The specified example allows remote connections to all databases stored on the server for all users who are connecting from the 192.168.0.XXX network address range. If other addressing is used in the system network, it is necessary to specify the appropriate address range instead of displayed. It is allowed to enter several lines with different address ranges.

    Note

    More details about this setting can be found in the PostgreSQL 16 documentation (see The pg_hba.conf File).

  4. Restart the postgresql-x64-16 service with the command prompt or by the default Services snap-in.

Removal of PostgreSQL๐Ÿ”—

Although PostgreSQL can be installed together with Eocortex, a simple removal of video surveillance system does not automatically delete DBMS.

PostgreSQL can be uninstalled using regular Windows tools designed for this purpose. For example, using the Programs and features snap-in from Control panel or Apps and Features from the Settings window.

Warning

Removal of PostgreSQL does not automatically remove its settings. When reinstalling the DBMS on the same computer, PostgreSQL will retain the settings from the previously created configuration files.

Rollback๐Ÿ”—

When rolling back the Eocortex server to a version lower than 4.6, the database is not migrated back to PostgreSQL 12, since PostgreSQL 12 and PostgreSQL 16 are not synchronized with each other.

After rollback, data from the Eocortex server will be recorded in PostgreSQL 16 with the following restrictions:

  • The mechanism for automatically recovering the PostgreSQL cluster after deleting the EocortexArchive folder on the archive drive will be unavailable.

  • Creating and recovering backups will be unavailable.

  • Errors related to the enabled wal_compression parameter will be logged. The error is related to the fact that the Eocortex server does not recognize the new PostgreSQL 16 response format to the parameter status query.

To roll back to PostgreSQL 12, proceed as follows:

  1. Stop the PostgreSQL 16 service and disable autostart.

  2. Start the PostgreSQL 12 service and enable autostart.