Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-23367

Update documentation about DB connection parameters

XMLWordPrintable

    • 1

      Currently we have misleading information about some DB connection parameters in documentation and configuration files when PostgreSQL is used as the DB engine for Zabbix.

      1) DBHost:

      ### Option: DBHost
      #       Database host name.
      #       If set to localhost, socket is used for MySQL.
      #       If set to empty string, socket is used for PostgreSQL.
      #       If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see
      #       the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located.
      #
      # Mandatory: no
      # Default:
      # DBHost=localhost
      

      Also documentation is saying that "With PostgreSQL only empty string results in attempt to use socket.".

      In fact, if you specify the directory with the socket file here, it will also use the socket connection. I guess this parameter actually behaves the same way as the "-h hostname" parameter in the psql utility and "If the value begins with a slash, it is used as the directory for the Unix-domain socket." Check the psql documentation. So you can specify the custom directory with if for some reason socket file is placed in non-standard location.

      For example, I've set up the PostgreSQL-based Zabbix instance to work throgh PgBouncer and the following parameter works perfectly fine for me:

      DBHost=/var/run/pgbouncer

      I would suggest to change it to something like "If the value begins with a slash, it is used as the directory for the Unix-domain socket for PostgreSQL. If set to empty string, default socket location /var/run/postgresql is used for PostgreSQL."

      Or maybe we could somehow combine it with DBSocket parameter instead, which is currenlty used for MySQL only - that would sound more logical from the users's perspective

       

      2) DBPort:

      ### Option: DBPort
      #       Database port when not using local socket.
      #       If the Net Service Name connection method is used to connect to Oracle database, the port number from the
      #       tnsnames.ora file will be used. The port number set here will be ignored.
      #
      # Mandatory: no
      # Range: 1024-65535
      # Default:
      # DBPort= 
      

      If socket connection is used with PostgreSQL, this parameters behaves as described in the "-p port" parameter in the psql utility: "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections."

      So if you would like to change the port of DB server to some other value and want to use socket connection, you will also need to set it here, becase it affects which file will be used for the connection ("/var/run/pgbouncer/.s.PGSQL.6432" in that case with the DBHost parameter specified in p.1, if the DBPort is set to 6432).

       


       

      Also, setup section during the first frontend launch probably should be rethinked as well, because it's not clear that you can actually set the socket path in the host field:

      And looks like with MySQL it's not possible to set custom socket for frontend connection at all, there is no "Database socket" option and "Database host" here doesn't accept filepaths:

       

      And that looks wrong - you can change this parameter for the server-DB connection but not for the frontend-DB. Why so?

        1. image-2023-09-06-16-06-20-999.png
          45 kB
          Denis Rasikhov
        2. image-2023-09-06-16-07-52-355.png
          43 kB
          Denis Rasikhov
        3. image-2023-09-06-16-17-48-223.png
          44 kB
          Denis Rasikhov

            vso Vladislavs Sokurenko
            drasikhov Denis Rasikhov
            Team D
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: