Zabbix 6.0 LTS: Step by step deployment guide with MySQL/PostgreSQL/TimescaleDB
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
🚀 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.
🔧 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.
🖥️ 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.
📦 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.
⚙️ 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
💡MySQL
💡PostgreSQL
💡TimescaleDB
💡Apache
💡Zabbix Web Frontend
💡dnf
💡Systemctl
💡Schema
💡SELinux
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
hello and welcome to zabik's series my
name is artur slontons and today we're
going to be talking about deploying
zybix from packages on different
database backends from mysql to postgres
to postgres with timescale db extension
so let's get started all right so i have
the zabic's download page open here and
we will start with installing xavix on a
mysql database backend on apache i will
select the xavix version 6.0 and then i
will select the os distribution which
will be oracle 8 in my case so oracle 8
my sql apache
then we'll have to install our my sql
database backend and then we can simply
follow these here instructions we'll
execute all of these steps in this video
and start using xavix so let's switch to
our terminal
all right so i have switched to my
terminal and now let's install the my
sql database backend so the command to
do that is simple dnf
dnf install my sql server yes this will
install my sql eight so we do need a
database backend where we store all of
our configuration all of our metrics
users and so on everything essentially
and for this use case the first one will
be using my sequel which is the probably
one of the more common ones most well
documented from the community side since
my sequel usage is very widespread out
there so let's give this a moment to
finish installing my sql server 8 and
then we can continue with the initial my
sql configuration
all right so everything has been
installed let's start our my sequel
instance so system
ctl enable my sequel d
dash now now means they will not just
enable it but it will also start it
all right let's give it a moment to
start up
and now what i recommend doing is
executing the mysql secure installation
binary i will copy and paste it here so
it's located under user bin my sql
secure installation this will give you
some initial configuration steps that
are very beneficial for example by
default the root user for my sql doesn't
have any password so this will help us
set up that
so first it will ask me if i wish to
have the validate password component
which accepts
only
relatively complex passwords i will skip
this for my test instance i will use a
simple password then i will provide a
password for root user here so new
password
there we go remove anonymous users yes
disallow root logins remotely in my case
yes but once again depends on your
requirement remove test database
yes and reload the privilege tables so
all of our changes are applied yes okay
that's done my sequel has been started
it's running we've done some minor
initial tuning security wise but also
one more thing that we can do
is we can open the
mysql config file located under etsy
my.cnf and we will see
that it includes files in etsy my cnf
directory and this is where we will be
able to tune our mysql further so let me
quit i will open etsy my cnf dot d
and then if i look at it we have my sql
server.cnf that's what we're looking for
mysql
server.cnf and here we can provide some
additional parameters for my sql tuning
this is very much recommended
for your instances especially if they're
not qa instances but production
instances so we do have blog posts and
videos on how to tune my sql for zabx
general tuning rules do apply here so if
you're familiar with my sql you might be
able to do this on your own but
definitely do some initial tuning since
i'm doing a small test instance here i
will leave it as is my sql use defaults
but you should definitely do some tuning
the same will apply for postgres another
database that we will look at today
all right and now we can continue with
the installation of zabx so
the zabic installation steps are quite
simple first we have to install zabic's
repository the command you can copy it
from the download page i will copy it
here so we're installing zabx 6.0 repo
quite quick i will also clean my dnf
cache in case if i have some old xavix
version repositories or components
cached in
cleaning the cache will sort of help you
avoiding
some potential issues when installing or
upgrading zabbix so i have cleaned it
next i will install the xavix components
once again dnf install i will copy the
command from the download page and then
zabik server for my sql so notice that
these packages have a suffix
so zabik server my sequel is a package
for my sequel zabik's web is the xavix
web package for my sequel and so on then
we'll be installing apache web backend
we will be downloading the zabik's sql
script and the selinux policy and the
agent so let's pass a yes to it and
let's install all of these components so
since we have quite a few components
here from server to front end to sql
script to see linux policies this might
take a while notice that the sql scripts
package is something that's relatively
new the package contains
the sort of initial setup sql scripts
that you will require for your fresh
environment
usually in previous versions they were
contained within the zabik's server
package now we have a separate package
for that so there are not only upgrade
scripts or initial setup scripts there
are a couple of other things in there
everything to do with changes to
zabic's database or implementing a new
database or upgrading
a database to for example use primary
keys which is something that 6.0
introduced so the scripts are in the
sql script package
so let's give this a moment to
finish installing zabi's components and
it's done so now what we have to do is
we have to create the initial database
so let's log into my sql my sql user
root and then password i will pass the
password that i provided for it i'm
logged in
and now i will create the initial
database the commands once again are
available in the download page
so the character set and collation are
used for zabics to not only support
multilingual essential environments but
also to
be able to make distinction between
lowercase and uppercase letters so
that's what the collation is for
and it's a requirement so if you're
following the download page commands you
will be good to go
next up we need to create azabex user
once again copy the command from the
download page create user zabic set
local host identified by and provide
your password i will provide an insecure
password for my qa environment since i'm
isolated from everything out there
but you provide something a bit more
secure so let's use sabix as a password
and then we will grant our xavix user
privileges on the xavix database grant
all privileges on zabic's to zabix at
localhost all right
privileges granted
now we can quit my sequel and now we
have an empty xavix database with the
user that has the necessary privileges
on it
our next step would be to deploy the
initial
database schema and data on this empty
database so once again copy the command
from the download page there it is we
will open up this
archive over here
server.sql and we will import it on our
xavix database by using the zabbix user
press enter and provide the password for
your xavix user and now we have to wait
for a moment so don't cancel anything
the schema and the data are currently
being imported so it may take a while
depending on your performance and some
other things so don't cancel this
okay we can see that the import has
finished i haven't touched anything it
will finish by itself
and now we have to open the zabic server
configuration file
located under etsy zabx zabxserver.conf
and i will search for db
password db password over here and i
will provide my database password db
password is zabx all right so there are
a couple of other database credentials
and other parameters that we can provide
for example database user database
socket database schema which is
something that can be used for postgres
database name over here if we have
created a database with a different name
and of course database host in my case
all of the components are running on the
same machine so i will be using the
default local host but your case could
be different let's save the changes
and now we can attempt and start
the zabic's components so i will do a
system ctl
enable for every component zabic servers
xavix agent web frontend and php
everything has been started and just to
be safe we can check zabik's logs so
open var log zabbix zavik server log
and we can see everything has been
started there are some warning messages
which is perfectly fine java polar isn't
running because we haven't enabled it in
the config file same for ipmi manager
same for vmware collector so perfectly
fine no database errors nothing
everything has been started
okay now we can open up our front end
all right and once we have opened the ip
address of our front end zabx
it will move us to the configuration of
the frontend so
the ip address here i'm running
everything on the same machine so that's
the ap address of my front-end server
and database also so first we have to
select the language
then we have to go through the
prerequisite checklist check if
everything is supported and okay
next we have to provide the user
and the password over here
for the front end to be able to connect
to the database that's the user that we
created previously
on the mysql database itself
then the database type host port and
name
since everything's running on the same
machine in my case i will use the
defaults
then go to the next step optionally
provide zabic server name this is
completely optional
default time zone default theme
and then pre-installation summary and we
should be good to go log in with the
default username admin and password zabx
all lowercase
and you're good to go
alright so we have managed to install
zabix on a mysql backend let's move to
postgres
all right for our second example we will
use zabik 6.0 oracle linux but this time
we will be installing xavix on a
postgres database backend so once again
the instructions are quite similar
except here we will see postgres
commands and of course as a prerequisite
we have to deploy a postgres database
backend so let's open our terminal and
let's do just that
all right so first things first we have
to install the postgres repository we'll
be installing the
postgres14 so let's install the
postgres14 repository
we will be using the latest repo and
we'll be using the one used for rhel8
since it's compatible with oracle linux
8 so let's install it
and after that we'll be done we will
have to do some additional steps
exclusive to postgres but let's wait for
the repository to be installed
all right the repository has been
installed so next let's do an optional
step and let's check
if we have some modules for older
postgres versions enabled and let's
disable them you can find the command
over here let's run it i don't think
that on this machine will necessarily
find any older modules but better to be
safe this very image depends on your
specific environment
so let's give this a moment it will
check for older postgres versions and
disable the corresponding modules
all right and now we can safely install
postgres 14 server so there it is dnf
install yes
postgres14 server let's install it
and this might take a moment once again
same as with the mysql database backend
so let's give this
some time all right that was actually
rather quick
now we have to initialize the postgres14
database
and there we go
we need to run the posers14 setup with
initialize database let's run it
the database has been initialized
successfully all right all's good now we
can try and start the postgres database
itself system control
enable postgres14 now we will enable and
start it
success
now we need to verify that everything is
working and connect to the postgres user
so we will use sudo su to connect to it
success we have connected to postgres
that's great now we can open the
postgres
command line over here there we go and
we have connected to the postgres
instance and it's up and running
everything looks good all right let's
quit
let's exit from the postgres user
and
now of course same as with my sql
ideally you would have to do some tuning
so let's open
var lib
pg sql
14
data and then postgresql postgresql.conf
and here we can find the postgres
configuration parameters that once again
we need to tune i will show you a good
tool to use for initial tuning in a
moment but what i wish to tune right now
right off the bat is maximum connections
so let's search for max connections
and it's 100
which depending on the size your zabex
instance might be maybe too small so
maybe you wish to tune it up to 150
let's save this and let's restart
postgres
so system control restart
postgresql
14
good and the changes have been applied
as for the other parameters i highly
recommend this here pg tune online tool
you can find it over here i will leave
the link in the description where you
can essentially provide
your hardware specifications and the
tool will generate
some
recommended parameters for your postgres
configuration so for example next type
of application let's say i have
eight gigs
for cpus 150 connections this is the
storage
and there we go it has provided me a
nice decent initial configuration which
is once again better than the default
one
so that's something that can be good if
you're maybe not feeling comfortable
configuring postgres from scratch
yourself
all right now let's move back to our
terminal
and let's install zabx
alright some of the next steps should
feel quite familiar to you so once again
we will install zabik 6.0 repository
there we go it has been installed we
will do a dnf clean all to clean the dnf
cache and we will install zaby's
component such as the server the front
end the agent so let's give them some
time to get installed
note that this time we are using the pg
sql packages as opposed to my sql
packages because for server and the web
components there are individual packages
for different types of database backends
so that's something that you don't want
to mix up pg sql for postgres
mysql for
mysql alright the components have been
installed
now what we have to do is we have to
create a zabx user for our postgres
database create user zabx and provide a
password for it
zabx like so and verify it
then we also have to create an empty
database
let's do this so create database
zabx let's go
and next up we have to import the
initial schema same as we did for my sql
so let's copy the command and as opposed
to my sql we can actually see
the tables and indexes and all of the
data
getting inserted into the database and
getting created so we just have to let
it finish
once we have finished importing the
initial schema and data once again we
have to open zabik's zabxserver.conf
look for the database password fields
and maybe any other fields that we need
to
tune and configure and provide the
password the hostname schema socket and
so on in my case i will be providing
only the password
and saving
the configuration now we can try and
start these avex components same as
before
system control enables avex server agent
frontend
with the now
flag and this will essentially not only
enable but also start everything
let's check the zabic server logs var
log zabik's zabx server log no error
messages everything seems to be good
and now same as before we can log into
our front end do the initial front-end
configuration and we should be good to
go
but that's not all
let's also deploy the time scale db
extension on this here postgres instance
to install the timescale db we will be
using the official timescale
documentation feel free to open it up
and follow my commands once again i'll
be installing on oracle linux 8 where
rhl8 instructions also work once we have
installed timescale then we will have to
deploy some prerequisite configuration
available in the xavix documentation
once again feel free to open up the
secure timescale db setup page
and follow what i'm doing
so let's get started and let's open up
our terminal and deploy timescale db
so over here i am using the same
instance as in the previous example we
have zabbix with postgres database
backend running and i will start by
stopping it system control stop zabbix
server
so there we go give it a moment
everything has been stopped and we will
first create a timescale db repository
file you can find the command in the
timescale db official documentation i
will simply copy and paste it
and hit enter and i have created a
timescale db repository file
then i will install
timescaledb
for
postgres14.
so over here dnf install timescale db2
postgres14 yes so let's give it a moment
it will grab the new repository and it
should be installed in a bit
all right we have installed timescale
now what we have to do
i will execute the timescale db tune
which will essentially provide some
initial tuning for timescale db
instances it's not perfect and we will
have to
fix it up most likely in a moment
but it does optimize your database for
time scale so we will have to provide
our pg config location which is user pg
sql 14 bin and mpg config time scale db
tune let's run it
now it's asking us about some of the
parameters that it wants to apply i will
agree to everything and then manually
change some things but in real life of
course go through each one of these and
decide if they work for you or should
they be tuned differently
all right
and
the timescale db tune has been executed
and it has updated our configuration we
can take a look at it
and i will change one parameter most
likely
so let's open our postgres config file
and what i'm going to change is the max
connections if i recall correctly yes it
has reset them to 25
which is not sufficient i will move it
back to 150 as it was before
save
and afterwards also restart postgres
let's do it
like so to apply the changes
now what we have to do is a couple of
simple steps first we need to apply the
time scale db extension on xavix
database you can find the command in our
documentation
so create extension timescale db on
zabics and we can see that the extension
has been applied
and then we have to do some initial
configuration for timescale by running a
timescale db.sql script
once again it's located in the zabic sql
scripts directory under user shared doc
postgres timescale db and we will use
our xavix user and apply it on our xavix
database
and it has been applied successfully
let's try and start our zabik server and
let's see if timescale is running
let's check our log files var
log zabik's zabx server log everything
has been started no error messages
another thing that we can do now
is we can open up our front end and take
a look if we have some new settings
under housekeeping
all right so let's navigate to
administration general housekeeping and
if we scroll all the way down we can see
that yes now with time scale db
we have the option to compress our
history and trends records which will
greatly free up the space on our
database back-end server and also under
the hood we have automated partitioning
running so that's also extremely great
no need to run
any custom scripts
so that's that i hope you enjoyed this
we have deployed zabics on mysql
postgres and postgres with timescale
database backends this should work as a
nice initial guide if you're starting
fresh with zabics or maybe you're
switching between database backhands and
you're new to postgres for example and
wondering how it can be quickly
configured thank you for your interest
guys i hope this was useful and i'll see
you next time
Weitere ähnliche Videos ansehen
5.0 / 5 (0 votes)