Usage of PostgreSQL on Windows🔗

PostgreSQL can be installed on Windows both in manual mode, using its own distribution packages of the required version, and in automatic mode as one of Eocortex components.

Scan for PostgreSQL on a computer

During the installation, the presence of PostgreSQL installed on the Eocortex is checked. Further steps will depend on the results of this check:

  • If PostgreSQL is installed and its version as required or higher, then Eocortex will use this installed instance.

  • If PostgreSQL is installed, but its version is lower than required, then during the Eocortex installation process it will be prompted to update PostgreSQL to the required version. The updated instance of PostgreSQL will be used by Eocortex afterwards.

  • If PostgreSQL is not installed, then during the Eocortex installation process it will be prompted to install PostgreSQL of the required version. During the installation process, a DBMS user with the name postgres and password masterkey will be automatically created.

Note

As part of the installation process, a DBMS user with the name postgres and the password masterkey will be automatically created.

Note

Depending on the Eocortex version, requirements to PostgreSQL version and automatic PostgreSQL installation processes will differ:

  • For Eocortex 3.4-3.6 it is required to install PostgreSQL 11.

  • For Eocortex 4.0 and higher it is required to install PostgreSQL 12.

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.

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.

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 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 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

Eocortex versions 4.0 and higher require PostgreSQL version 12 to store all internal databases.

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.

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.

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.

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 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\postgredb\
    
  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. More details about this setting can be found in the PostgreSQL 12 documentation.

  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. More details about this setting can be found in the PostgreSQL 12 documentation.

  4. Restart the postgresql-x64-12 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.