Zabbix 6.0 LTS: Step by step deployment guide with MySQL/PostgreSQL/TimescaleDB

Zabbix
1 Jul 202224:10

Summary

TLDRIn this video, Artur Slontons demonstrates how to deploy Zabbix using different database backends, including MySQL, PostgreSQL, and PostgreSQL with the TimescaleDB extension. The tutorial covers installation on Oracle Linux, configuring MySQL and PostgreSQL databases, initial security steps, and fine-tuning configurations for optimal performance. Slontons also walks through setting up Zabbix’s front-end, managing database schemas, and enabling TimescaleDB for enhanced data storage efficiency. This guide is aimed at users looking to implement Zabbix across various environments with a focus on best practices and efficiency.

Takeaways

  • 🖥️ The video is about deploying Zabbix on different database backends including MySQL, PostgreSQL, and PostgreSQL with the TimescaleDB extension.
  • 📥 The first step involves downloading and installing Zabbix 6.0 on a MySQL database backend, using Oracle Linux 8 and Apache.
  • 🔧 The MySQL setup includes installing MySQL Server 8, securing the installation, and performing initial configuration like password setting for the root user.
  • 🗃️ Zabbix repository and components are installed next, and a MySQL database is created with the required permissions for the Zabbix user.
  • ⚙️ After configuring the database and Zabbix server, the video covers starting the Zabbix components and checking for any errors in the log files.
  • 🛠️ The process is repeated for a PostgreSQL backend, installing PostgreSQL 14 and performing necessary tuning using tools like PG Tune for optimal performance.
  • 📊 The video explains how to create the Zabbix database, configure the database user, and import the necessary schema for Zabbix on PostgreSQL.
  • 🚀 The video also demonstrates deploying Zabbix with the TimescaleDB extension, which involves installing the TimescaleDB repository and performing initial tuning.
  • 🔍 TimescaleDB is configured to optimize database space by compressing history and trends records, and automated partitioning is enabled for performance improvement.
  • 📑 The video concludes with a recap of the steps to deploy Zabbix on MySQL, PostgreSQL, and PostgreSQL with TimescaleDB, providing a practical guide for users switching between database backends.

Q & A

  • What are the main database backends discussed for deploying Zabbix?

    -The main database backends discussed for deploying Zabbix in the video are MySQL, PostgreSQL, and PostgreSQL with TimescaleDB extension.

  • What is the purpose of using MySQL secure installation during the setup?

    -The MySQL secure installation step helps improve security by allowing you to set a password for the root user, remove anonymous users, disallow root logins remotely, and remove the test database.

  • Why is it important to tune the MySQL configuration for Zabbix, especially in production environments?

    -Tuning the MySQL configuration is important for optimizing performance, especially in production environments where large amounts of data are being processed. Proper tuning can prevent issues with performance bottlenecks and resource limitations.

  • How does Zabbix handle SQL scripts in version 6.0 compared to previous versions?

    -In Zabbix version 6.0, the SQL scripts required for the initial setup or upgrades are now part of a separate package (zabbix-sql-scripts), whereas in previous versions, these scripts were included in the Zabbix server package.

  • What is the significance of setting the correct character set and collation when creating the Zabbix database?

    -Setting the correct character set and collation ensures that Zabbix supports multilingual environments and can properly handle case-sensitive data distinctions, which is required for Zabbix to function correctly.

  • What are the key steps involved in setting up PostgreSQL for Zabbix?

    -The key steps for setting up PostgreSQL for Zabbix include installing the PostgreSQL repository, disabling any older PostgreSQL modules, installing PostgreSQL 14, initializing the database, configuring necessary settings (like max connections), and creating the Zabbix database and user.

  • What tool does the video suggest for tuning PostgreSQL, and why is it helpful?

    -The video suggests using the PG Tune online tool, which helps generate recommended configuration parameters for PostgreSQL based on the hardware specifications and application type. It is helpful because it provides a more optimized configuration than the default settings.

  • What is the TimescaleDB extension used for in the context of Zabbix?

    -The TimescaleDB extension is used to enhance PostgreSQL's capabilities by enabling automated partitioning of historical data and providing compression for history and trends records, which improves database performance and reduces storage usage.

  • How is TimescaleDB configured for Zabbix, and what are its benefits?

    -TimescaleDB is configured by installing the TimescaleDB repository and package, running the timescaledb-tune command for initial tuning, and applying the TimescaleDB extension on the Zabbix database. Its benefits include automated partitioning and the ability to compress historical data, improving performance and reducing database size.

  • How can you check whether Zabbix has started successfully after installation?

    -To check if Zabbix has started successfully, you can review the Zabbix server logs located in `/var/log/zabbix/zabbix_server.log`. If there are no error messages and only warnings, it indicates that the server has started correctly.

Outlines

00:00

🚀 Introduction to Zabbix Deployment and MySQL Setup

The speaker introduces a tutorial on deploying Zabbix using various database backends, starting with MySQL. The process involves downloading Zabbix, selecting the correct version (6.0), operating system (Oracle 8), and database (MySQL), followed by installing and configuring MySQL. The speaker provides detailed instructions on how to install MySQL, secure the installation, and perform essential configuration, including setting up a password for the root user, removing anonymous users, and disallowing remote root logins.

05:01

🔧 Installing Zabbix Components and Setting Up Apache

This section explains the steps to install Zabbix components using the MySQL backend. The speaker installs various Zabbix packages, including Zabbix server, frontend, and SQL scripts, followed by the configuration of Apache for web hosting. The SQL scripts package is highlighted as a separate new feature introduced in Zabbix 6.0, containing setup and upgrade scripts. The speaker provides guidance on how to create a Zabbix user and database, as well as grant necessary privileges, before importing the initial schema and data.

10:03

🖥️ Configuring Zabbix Frontend and Testing MySQL Setup

The speaker continues with configuring the Zabbix frontend by navigating through installation steps such as selecting the language, configuring database settings, and verifying prerequisites. Key steps include setting up the database connection using the user and password created earlier. The frontend configuration concludes with the user logging into Zabbix with default credentials, confirming that the installation on MySQL is complete and operational.

15:06

📦 Switching to PostgreSQL for Zabbix Installation

In this section, the tutorial shifts to installing Zabbix using PostgreSQL as the database backend. The speaker provides instructions for installing the PostgreSQL repository and initializing the database. Similar to the MySQL setup, the PostgreSQL installation involves creating a Zabbix user, setting up an empty database, and importing the Zabbix schema. Important steps such as tuning PostgreSQL settings for better performance, including max connections, are discussed.

20:06

⚙️ Enhancing PostgreSQL with TimescaleDB for Zabbix

The final segment of the tutorial focuses on adding the TimescaleDB extension to PostgreSQL to optimize Zabbix for time-series data. The speaker demonstrates how to install the TimescaleDB repository, run configuration tuning scripts, and apply the TimescaleDB extension to the Zabbix database. By enabling features like history and trends compression, the TimescaleDB integration significantly improves storage efficiency. The tutorial concludes with the successful deployment of Zabbix on a PostgreSQL backend with TimescaleDB, ensuring optimal performance for large-scale monitoring.

Mindmap

Keywords

💡Zabbix

Zabbix is an open-source monitoring software used for monitoring servers, networks, and applications. In the video, Zabbix is installed and configured on different database backends, showcasing how to deploy it on MySQL and PostgreSQL databases, and how to optimize it for performance with TimescaleDB.

💡MySQL

MySQL is a popular relational database management system. The video demonstrates the process of installing Zabbix with a MySQL database backend, including setting up the MySQL server, securing the root user, and configuring it for use with Zabbix.

💡PostgreSQL

PostgreSQL is another powerful relational database management system. In the video, the installation of Zabbix with a PostgreSQL backend is covered, including setting up the PostgreSQL server, creating the necessary databases and users, and applying Zabbix-specific configurations.

💡TimescaleDB

TimescaleDB is an extension for PostgreSQL that is optimized for time-series data. In the video, TimescaleDB is added to enhance Zabbix’s PostgreSQL setup, which helps with data partitioning and compression, especially for handling large amounts of time-series data generated by Zabbix.

💡Apache

Apache is an open-source web server software. The video includes the installation of Apache as part of the Zabbix setup, which is used to serve the Zabbix web frontend, allowing users to interact with Zabbix through a web interface.

💡Zabbix Web Frontend

The Zabbix web frontend is the graphical interface that allows users to interact with the Zabbix server. In the video, the frontend is installed on both MySQL and PostgreSQL setups, and users are guided through the configuration process, including setting up database connections and verifying the installation.

💡dnf

DNF (Dandified Yum) is a package manager used in Red Hat-based Linux distributions like Oracle Linux, which is used in the video. The script shows how to use the 'dnf' command to install necessary packages for Zabbix, including MySQL, PostgreSQL, TimescaleDB, and Zabbix components.

💡Systemctl

Systemctl is a command-line utility used to control system services. In the video, systemctl is used to start and enable services such as MySQL, PostgreSQL, and the Zabbix server and agent, ensuring that they run automatically on system startup.

💡Schema

A schema refers to the structure of a database, including tables, relationships, and constraints. The video discusses importing the Zabbix schema into the MySQL and PostgreSQL databases, which is a necessary step to set up the Zabbix monitoring system by initializing the database with the correct structure.

💡SELinux

SELinux (Security-Enhanced Linux) is a security module in Linux. In the video, SELinux policies for Zabbix are discussed, ensuring that the necessary permissions are in place for Zabbix to operate correctly within a secure Linux environment.

Highlights

Introduction to deploying Zabbix using different database backends: MySQL, PostgreSQL, and PostgreSQL with TimescaleDB.

Installing MySQL as a database backend for Zabbix using Oracle Linux 8.

Step-by-step process for configuring MySQL database, including security enhancements like setting root password and removing anonymous users.

Instructions on MySQL tuning for production environments, including initial configuration adjustments in `my.cnf`.

Deploying Zabbix 6.0 repository, server components, and web frontend using MySQL.

Creating a Zabbix database and user in MySQL, and initializing the schema for the Zabbix environment.

Starting and verifying Zabbix components and checking server logs to ensure successful setup with MySQL.

Transitioning from MySQL to PostgreSQL as the database backend for Zabbix, with detailed installation steps for PostgreSQL 14 on Oracle Linux 8.

Customizing PostgreSQL settings, such as increasing maximum connections, using `postgresql.conf` for tuning.

Introduction to PG Tune, an online tool for generating optimized configuration settings based on hardware specifications for PostgreSQL.

Installing Zabbix with PostgreSQL backend and running SQL scripts to set up the database schema.

Enabling TimescaleDB extension in PostgreSQL for Zabbix to optimize database performance for time-series data.

Running `timescaledb-tune` to automatically optimize PostgreSQL for TimescaleDB and adjust connection limits.

Verifying successful TimescaleDB setup in Zabbix logs and accessing new housekeeping features, such as automatic data compression for historical data.

Final review of deploying Zabbix on MySQL, PostgreSQL, and PostgreSQL with TimescaleDB, including recommendations for different database environments.

Transcripts

play00:00

hello and welcome to zabik's series my

play00:02

name is artur slontons and today we're

play00:04

going to be talking about deploying

play00:06

zybix from packages on different

play00:08

database backends from mysql to postgres

play00:11

to postgres with timescale db extension

play00:14

so let's get started all right so i have

play00:16

the zabic's download page open here and

play00:18

we will start with installing xavix on a

play00:21

mysql database backend on apache i will

play00:23

select the xavix version 6.0 and then i

play00:26

will select the os distribution which

play00:28

will be oracle 8 in my case so oracle 8

play00:32

my sql apache

play00:34

then we'll have to install our my sql

play00:36

database backend and then we can simply

play00:38

follow these here instructions we'll

play00:40

execute all of these steps in this video

play00:43

and start using xavix so let's switch to

play00:46

our terminal

play00:47

all right so i have switched to my

play00:49

terminal and now let's install the my

play00:51

sql database backend so the command to

play00:53

do that is simple dnf

play00:55

dnf install my sql server yes this will

play01:01

install my sql eight so we do need a

play01:04

database backend where we store all of

play01:06

our configuration all of our metrics

play01:08

users and so on everything essentially

play01:10

and for this use case the first one will

play01:12

be using my sequel which is the probably

play01:15

one of the more common ones most well

play01:17

documented from the community side since

play01:20

my sequel usage is very widespread out

play01:22

there so let's give this a moment to

play01:24

finish installing my sql server 8 and

play01:27

then we can continue with the initial my

play01:28

sql configuration

play01:31

all right so everything has been

play01:32

installed let's start our my sequel

play01:35

instance so system

play01:37

ctl enable my sequel d

play01:40

dash now now means they will not just

play01:43

enable it but it will also start it

play01:47

all right let's give it a moment to

play01:48

start up

play01:50

and now what i recommend doing is

play01:52

executing the mysql secure installation

play01:55

binary i will copy and paste it here so

play01:57

it's located under user bin my sql

play02:01

secure installation this will give you

play02:03

some initial configuration steps that

play02:06

are very beneficial for example by

play02:08

default the root user for my sql doesn't

play02:10

have any password so this will help us

play02:12

set up that

play02:13

so first it will ask me if i wish to

play02:15

have the validate password component

play02:17

which accepts

play02:19

only

play02:20

relatively complex passwords i will skip

play02:22

this for my test instance i will use a

play02:24

simple password then i will provide a

play02:27

password for root user here so new

play02:30

password

play02:32

there we go remove anonymous users yes

play02:35

disallow root logins remotely in my case

play02:38

yes but once again depends on your

play02:40

requirement remove test database

play02:43

yes and reload the privilege tables so

play02:46

all of our changes are applied yes okay

play02:50

that's done my sequel has been started

play02:52

it's running we've done some minor

play02:54

initial tuning security wise but also

play02:58

one more thing that we can do

play03:00

is we can open the

play03:02

mysql config file located under etsy

play03:06

my.cnf and we will see

play03:08

that it includes files in etsy my cnf

play03:12

directory and this is where we will be

play03:13

able to tune our mysql further so let me

play03:17

quit i will open etsy my cnf dot d

play03:22

and then if i look at it we have my sql

play03:25

server.cnf that's what we're looking for

play03:27

mysql

play03:29

server.cnf and here we can provide some

play03:31

additional parameters for my sql tuning

play03:34

this is very much recommended

play03:36

for your instances especially if they're

play03:39

not qa instances but production

play03:40

instances so we do have blog posts and

play03:43

videos on how to tune my sql for zabx

play03:45

general tuning rules do apply here so if

play03:48

you're familiar with my sql you might be

play03:49

able to do this on your own but

play03:51

definitely do some initial tuning since

play03:53

i'm doing a small test instance here i

play03:55

will leave it as is my sql use defaults

play03:58

but you should definitely do some tuning

play04:00

the same will apply for postgres another

play04:02

database that we will look at today

play04:05

all right and now we can continue with

play04:08

the installation of zabx so

play04:10

the zabic installation steps are quite

play04:12

simple first we have to install zabic's

play04:15

repository the command you can copy it

play04:17

from the download page i will copy it

play04:20

here so we're installing zabx 6.0 repo

play04:23

quite quick i will also clean my dnf

play04:26

cache in case if i have some old xavix

play04:29

version repositories or components

play04:31

cached in

play04:32

cleaning the cache will sort of help you

play04:35

avoiding

play04:36

some potential issues when installing or

play04:39

upgrading zabbix so i have cleaned it

play04:42

next i will install the xavix components

play04:44

once again dnf install i will copy the

play04:47

command from the download page and then

play04:49

zabik server for my sql so notice that

play04:52

these packages have a suffix

play04:54

so zabik server my sequel is a package

play04:57

for my sequel zabik's web is the xavix

play05:00

web package for my sequel and so on then

play05:03

we'll be installing apache web backend

play05:06

we will be downloading the zabik's sql

play05:08

script and the selinux policy and the

play05:12

agent so let's pass a yes to it and

play05:15

let's install all of these components so

play05:16

since we have quite a few components

play05:18

here from server to front end to sql

play05:21

script to see linux policies this might

play05:24

take a while notice that the sql scripts

play05:27

package is something that's relatively

play05:29

new the package contains

play05:31

the sort of initial setup sql scripts

play05:34

that you will require for your fresh

play05:36

environment

play05:37

usually in previous versions they were

play05:39

contained within the zabik's server

play05:41

package now we have a separate package

play05:44

for that so there are not only upgrade

play05:46

scripts or initial setup scripts there

play05:48

are a couple of other things in there

play05:49

everything to do with changes to

play05:52

zabic's database or implementing a new

play05:55

database or upgrading

play05:57

a database to for example use primary

play05:59

keys which is something that 6.0

play06:02

introduced so the scripts are in the

play06:04

sql script package

play06:08

so let's give this a moment to

play06:10

finish installing zabi's components and

play06:12

it's done so now what we have to do is

play06:15

we have to create the initial database

play06:18

so let's log into my sql my sql user

play06:23

root and then password i will pass the

play06:25

password that i provided for it i'm

play06:28

logged in

play06:29

and now i will create the initial

play06:30

database the commands once again are

play06:32

available in the download page

play06:37

so the character set and collation are

play06:40

used for zabics to not only support

play06:42

multilingual essential environments but

play06:45

also to

play06:47

be able to make distinction between

play06:49

lowercase and uppercase letters so

play06:51

that's what the collation is for

play06:52

and it's a requirement so if you're

play06:55

following the download page commands you

play06:57

will be good to go

play06:59

next up we need to create azabex user

play07:01

once again copy the command from the

play07:03

download page create user zabic set

play07:06

local host identified by and provide

play07:08

your password i will provide an insecure

play07:10

password for my qa environment since i'm

play07:12

isolated from everything out there

play07:15

but you provide something a bit more

play07:16

secure so let's use sabix as a password

play07:20

and then we will grant our xavix user

play07:23

privileges on the xavix database grant

play07:25

all privileges on zabic's to zabix at

play07:28

localhost all right

play07:31

privileges granted

play07:33

now we can quit my sequel and now we

play07:35

have an empty xavix database with the

play07:37

user that has the necessary privileges

play07:40

on it

play07:41

our next step would be to deploy the

play07:44

initial

play07:45

database schema and data on this empty

play07:48

database so once again copy the command

play07:50

from the download page there it is we

play07:53

will open up this

play07:55

archive over here

play07:56

server.sql and we will import it on our

play07:59

xavix database by using the zabbix user

play08:03

press enter and provide the password for

play08:05

your xavix user and now we have to wait

play08:07

for a moment so don't cancel anything

play08:10

the schema and the data are currently

play08:12

being imported so it may take a while

play08:15

depending on your performance and some

play08:17

other things so don't cancel this

play08:20

okay we can see that the import has

play08:22

finished i haven't touched anything it

play08:24

will finish by itself

play08:26

and now we have to open the zabic server

play08:28

configuration file

play08:31

located under etsy zabx zabxserver.conf

play08:35

and i will search for db

play08:37

password db password over here and i

play08:40

will provide my database password db

play08:42

password is zabx all right so there are

play08:45

a couple of other database credentials

play08:47

and other parameters that we can provide

play08:49

for example database user database

play08:52

socket database schema which is

play08:54

something that can be used for postgres

play08:57

database name over here if we have

play08:58

created a database with a different name

play09:01

and of course database host in my case

play09:03

all of the components are running on the

play09:05

same machine so i will be using the

play09:06

default local host but your case could

play09:09

be different let's save the changes

play09:12

and now we can attempt and start

play09:15

the zabic's components so i will do a

play09:19

system ctl

play09:20

enable for every component zabic servers

play09:24

xavix agent web frontend and php

play09:28

everything has been started and just to

play09:31

be safe we can check zabik's logs so

play09:33

open var log zabbix zavik server log

play09:38

and we can see everything has been

play09:39

started there are some warning messages

play09:41

which is perfectly fine java polar isn't

play09:44

running because we haven't enabled it in

play09:46

the config file same for ipmi manager

play09:49

same for vmware collector so perfectly

play09:52

fine no database errors nothing

play09:54

everything has been started

play09:56

okay now we can open up our front end

play09:58

all right and once we have opened the ip

play10:00

address of our front end zabx

play10:03

it will move us to the configuration of

play10:05

the frontend so

play10:07

the ip address here i'm running

play10:09

everything on the same machine so that's

play10:11

the ap address of my front-end server

play10:13

and database also so first we have to

play10:16

select the language

play10:18

then we have to go through the

play10:20

prerequisite checklist check if

play10:22

everything is supported and okay

play10:24

next we have to provide the user

play10:27

and the password over here

play10:29

for the front end to be able to connect

play10:32

to the database that's the user that we

play10:34

created previously

play10:36

on the mysql database itself

play10:38

then the database type host port and

play10:42

name

play10:42

since everything's running on the same

play10:44

machine in my case i will use the

play10:45

defaults

play10:47

then go to the next step optionally

play10:49

provide zabic server name this is

play10:51

completely optional

play10:53

default time zone default theme

play10:56

and then pre-installation summary and we

play11:00

should be good to go log in with the

play11:02

default username admin and password zabx

play11:06

all lowercase

play11:07

and you're good to go

play11:09

alright so we have managed to install

play11:11

zabix on a mysql backend let's move to

play11:14

postgres

play11:16

all right for our second example we will

play11:18

use zabik 6.0 oracle linux but this time

play11:22

we will be installing xavix on a

play11:24

postgres database backend so once again

play11:28

the instructions are quite similar

play11:29

except here we will see postgres

play11:31

commands and of course as a prerequisite

play11:34

we have to deploy a postgres database

play11:37

backend so let's open our terminal and

play11:40

let's do just that

play11:42

all right so first things first we have

play11:44

to install the postgres repository we'll

play11:46

be installing the

play11:48

postgres14 so let's install the

play11:52

postgres14 repository

play11:54

we will be using the latest repo and

play11:57

we'll be using the one used for rhel8

play12:00

since it's compatible with oracle linux

play12:03

8 so let's install it

play12:05

and after that we'll be done we will

play12:08

have to do some additional steps

play12:10

exclusive to postgres but let's wait for

play12:12

the repository to be installed

play12:15

all right the repository has been

play12:17

installed so next let's do an optional

play12:20

step and let's check

play12:22

if we have some modules for older

play12:25

postgres versions enabled and let's

play12:26

disable them you can find the command

play12:28

over here let's run it i don't think

play12:31

that on this machine will necessarily

play12:33

find any older modules but better to be

play12:35

safe this very image depends on your

play12:37

specific environment

play12:40

so let's give this a moment it will

play12:41

check for older postgres versions and

play12:44

disable the corresponding modules

play12:47

all right and now we can safely install

play12:50

postgres 14 server so there it is dnf

play12:54

install yes

play12:56

postgres14 server let's install it

play13:00

and this might take a moment once again

play13:02

same as with the mysql database backend

play13:05

so let's give this

play13:06

some time all right that was actually

play13:08

rather quick

play13:10

now we have to initialize the postgres14

play13:13

database

play13:14

and there we go

play13:16

we need to run the posers14 setup with

play13:20

initialize database let's run it

play13:24

the database has been initialized

play13:27

successfully all right all's good now we

play13:29

can try and start the postgres database

play13:32

itself system control

play13:34

enable postgres14 now we will enable and

play13:37

start it

play13:39

success

play13:40

now we need to verify that everything is

play13:42

working and connect to the postgres user

play13:46

so we will use sudo su to connect to it

play13:52

success we have connected to postgres

play13:54

that's great now we can open the

play13:57

postgres

play13:58

command line over here there we go and

play14:02

we have connected to the postgres

play14:03

instance and it's up and running

play14:06

everything looks good all right let's

play14:09

quit

play14:10

let's exit from the postgres user

play14:13

and

play14:14

now of course same as with my sql

play14:17

ideally you would have to do some tuning

play14:20

so let's open

play14:21

var lib

play14:23

pg sql

play14:25

14

play14:26

data and then postgresql postgresql.conf

play14:31

and here we can find the postgres

play14:33

configuration parameters that once again

play14:36

we need to tune i will show you a good

play14:38

tool to use for initial tuning in a

play14:40

moment but what i wish to tune right now

play14:42

right off the bat is maximum connections

play14:45

so let's search for max connections

play14:47

and it's 100

play14:49

which depending on the size your zabex

play14:51

instance might be maybe too small so

play14:54

maybe you wish to tune it up to 150

play14:57

let's save this and let's restart

play15:01

postgres

play15:02

so system control restart

play15:06

postgresql

play15:07

14

play15:09

good and the changes have been applied

play15:12

as for the other parameters i highly

play15:14

recommend this here pg tune online tool

play15:17

you can find it over here i will leave

play15:19

the link in the description where you

play15:22

can essentially provide

play15:23

your hardware specifications and the

play15:26

tool will generate

play15:28

some

play15:29

recommended parameters for your postgres

play15:31

configuration so for example next type

play15:34

of application let's say i have

play15:37

eight gigs

play15:39

for cpus 150 connections this is the

play15:43

storage

play15:44

and there we go it has provided me a

play15:46

nice decent initial configuration which

play15:48

is once again better than the default

play15:50

one

play15:51

so that's something that can be good if

play15:53

you're maybe not feeling comfortable

play15:55

configuring postgres from scratch

play15:58

yourself

play15:59

all right now let's move back to our

play16:00

terminal

play16:02

and let's install zabx

play16:04

alright some of the next steps should

play16:06

feel quite familiar to you so once again

play16:08

we will install zabik 6.0 repository

play16:12

there we go it has been installed we

play16:14

will do a dnf clean all to clean the dnf

play16:18

cache and we will install zaby's

play16:20

component such as the server the front

play16:23

end the agent so let's give them some

play16:26

time to get installed

play16:29

note that this time we are using the pg

play16:31

sql packages as opposed to my sql

play16:34

packages because for server and the web

play16:36

components there are individual packages

play16:38

for different types of database backends

play16:40

so that's something that you don't want

play16:42

to mix up pg sql for postgres

play16:46

mysql for

play16:48

mysql alright the components have been

play16:51

installed

play16:52

now what we have to do is we have to

play16:54

create a zabx user for our postgres

play16:57

database create user zabx and provide a

play17:00

password for it

play17:02

zabx like so and verify it

play17:05

then we also have to create an empty

play17:07

database

play17:09

let's do this so create database

play17:12

zabx let's go

play17:16

and next up we have to import the

play17:18

initial schema same as we did for my sql

play17:22

so let's copy the command and as opposed

play17:25

to my sql we can actually see

play17:28

the tables and indexes and all of the

play17:31

data

play17:32

getting inserted into the database and

play17:34

getting created so we just have to let

play17:37

it finish

play17:39

once we have finished importing the

play17:41

initial schema and data once again we

play17:44

have to open zabik's zabxserver.conf

play17:47

look for the database password fields

play17:50

and maybe any other fields that we need

play17:52

to

play17:53

tune and configure and provide the

play17:55

password the hostname schema socket and

play17:58

so on in my case i will be providing

play18:00

only the password

play18:01

and saving

play18:03

the configuration now we can try and

play18:06

start these avex components same as

play18:09

before

play18:10

system control enables avex server agent

play18:13

frontend

play18:14

with the now

play18:16

flag and this will essentially not only

play18:19

enable but also start everything

play18:22

let's check the zabic server logs var

play18:25

log zabik's zabx server log no error

play18:28

messages everything seems to be good

play18:31

and now same as before we can log into

play18:33

our front end do the initial front-end

play18:35

configuration and we should be good to

play18:38

go

play18:39

but that's not all

play18:40

let's also deploy the time scale db

play18:43

extension on this here postgres instance

play18:48

to install the timescale db we will be

play18:50

using the official timescale

play18:52

documentation feel free to open it up

play18:55

and follow my commands once again i'll

play18:57

be installing on oracle linux 8 where

play19:00

rhl8 instructions also work once we have

play19:03

installed timescale then we will have to

play19:06

deploy some prerequisite configuration

play19:09

available in the xavix documentation

play19:11

once again feel free to open up the

play19:13

secure timescale db setup page

play19:16

and follow what i'm doing

play19:18

so let's get started and let's open up

play19:20

our terminal and deploy timescale db

play19:24

so over here i am using the same

play19:26

instance as in the previous example we

play19:29

have zabbix with postgres database

play19:32

backend running and i will start by

play19:34

stopping it system control stop zabbix

play19:38

server

play19:39

so there we go give it a moment

play19:41

everything has been stopped and we will

play19:43

first create a timescale db repository

play19:46

file you can find the command in the

play19:49

timescale db official documentation i

play19:51

will simply copy and paste it

play19:54

and hit enter and i have created a

play19:56

timescale db repository file

play20:00

then i will install

play20:02

timescaledb

play20:03

for

play20:04

postgres14.

play20:06

so over here dnf install timescale db2

play20:10

postgres14 yes so let's give it a moment

play20:14

it will grab the new repository and it

play20:16

should be installed in a bit

play20:20

all right we have installed timescale

play20:22

now what we have to do

play20:25

i will execute the timescale db tune

play20:28

which will essentially provide some

play20:30

initial tuning for timescale db

play20:32

instances it's not perfect and we will

play20:35

have to

play20:36

fix it up most likely in a moment

play20:38

but it does optimize your database for

play20:42

time scale so we will have to provide

play20:45

our pg config location which is user pg

play20:48

sql 14 bin and mpg config time scale db

play20:53

tune let's run it

play20:55

now it's asking us about some of the

play20:57

parameters that it wants to apply i will

play20:59

agree to everything and then manually

play21:01

change some things but in real life of

play21:04

course go through each one of these and

play21:06

decide if they work for you or should

play21:09

they be tuned differently

play21:30

all right

play21:31

and

play21:32

the timescale db tune has been executed

play21:35

and it has updated our configuration we

play21:38

can take a look at it

play21:39

and i will change one parameter most

play21:42

likely

play21:43

so let's open our postgres config file

play21:46

and what i'm going to change is the max

play21:49

connections if i recall correctly yes it

play21:51

has reset them to 25

play21:53

which is not sufficient i will move it

play21:56

back to 150 as it was before

play21:59

save

play22:00

and afterwards also restart postgres

play22:05

let's do it

play22:06

like so to apply the changes

play22:10

now what we have to do is a couple of

play22:13

simple steps first we need to apply the

play22:15

time scale db extension on xavix

play22:17

database you can find the command in our

play22:19

documentation

play22:21

so create extension timescale db on

play22:24

zabics and we can see that the extension

play22:27

has been applied

play22:29

and then we have to do some initial

play22:31

configuration for timescale by running a

play22:33

timescale db.sql script

play22:35

once again it's located in the zabic sql

play22:38

scripts directory under user shared doc

play22:41

postgres timescale db and we will use

play22:44

our xavix user and apply it on our xavix

play22:48

database

play22:49

and it has been applied successfully

play22:51

let's try and start our zabik server and

play22:54

let's see if timescale is running

play22:57

let's check our log files var

play23:00

log zabik's zabx server log everything

play23:04

has been started no error messages

play23:06

another thing that we can do now

play23:09

is we can open up our front end and take

play23:11

a look if we have some new settings

play23:13

under housekeeping

play23:15

all right so let's navigate to

play23:17

administration general housekeeping and

play23:20

if we scroll all the way down we can see

play23:22

that yes now with time scale db

play23:25

we have the option to compress our

play23:27

history and trends records which will

play23:29

greatly free up the space on our

play23:32

database back-end server and also under

play23:35

the hood we have automated partitioning

play23:38

running so that's also extremely great

play23:40

no need to run

play23:41

any custom scripts

play23:44

so that's that i hope you enjoyed this

play23:46

we have deployed zabics on mysql

play23:48

postgres and postgres with timescale

play23:51

database backends this should work as a

play23:54

nice initial guide if you're starting

play23:56

fresh with zabics or maybe you're

play23:58

switching between database backhands and

play24:00

you're new to postgres for example and

play24:02

wondering how it can be quickly

play24:03

configured thank you for your interest

play24:05

guys i hope this was useful and i'll see

play24:08

you next time

Rate This

5.0 / 5 (0 votes)

相关标签
Zabbix InstallationMySQL SetupPostgreSQLTimescaleDBDatabase TuningLinux ServerApacheOracle LinuxSysadmin GuideDatabase Backends
您是否需要英文摘要?