Zabbix Documentation 4.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:appendix:install:db_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:appendix:install:db_scripts [2019/04/02 06:04]
127.0.0.1 external edit
manual:appendix:install:db_scripts [2020/03/06 08:05] (current)
martins-v fixing link target
Line 18: Line 18:
   shell> mysql -uroot -p<​password>​   shell> mysql -uroot -p<​password>​
   mysql> create database zabbix character set utf8 collate utf8_bin;   mysql> create database zabbix character set utf8 collate utf8_bin;
-  mysql> grant all privileges on zabbix.* to [email protected]localhost identified by '<​password>​';+  ​mysql> create user '​zabbix'​@'​localhost'​ identified by '<​password>';​ 
 +  ​mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
   mysql> quit;   mysql> quit;
  
-If you use Zabbix packages continue with instructions for [[manual:​installation:​install_from_packages:​debian_ubuntu#​importing_data|Debian/​Ubuntu]] or [[manual:​installation:​install_from_packages:​rhel_centos#​importing_data|RHEL/​CentOS]] to import the data into the database.+<note warning>If you are installing from Zabbix packages, stop here and continue with instructions for [[manual:​installation:​install_from_packages:​debian_ubuntu#​importing_data|Debian/​Ubuntu]] or [[manual:​installation:​install_from_packages:​rhel_centos#​importing_data|RHEL/​CentOS]] to import the data into the database.</​note>​ 
 + 
 +If you are installing Zabbix from sources, proceed to import the data into the database:
  
   shell> cd database/​mysql   shell> cd database/​mysql
Line 35: Line 38:
   shell> sudo -u postgres createuser --pwprompt zabbix   shell> sudo -u postgres createuser --pwprompt zabbix
  
-Now we will set up the database ''​zabbix''​ (last parameter) with the previously created user as the owner (''​-O zabbix''​) ​and import initial schema and data (assuming you are in the root directory of Zabbix sources):+Now we will set up the database ''​zabbix''​ (last parameter) with the previously created user as the owner (''​-O zabbix''​).
  
   shell> sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix   shell> sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix
  
-If you use Zabbix packages continue with instructions for [[manual:​installation:​install_from_packages:​debian_ubuntu#​importing_data|Debian/​Ubuntu]] or [[manual:​installation:​install_from_packages:​rhel_centos#​importing_data|RHEL/​CentOS]] to import the data into the database.+<note warning>If you are installing from Zabbix packages, stop here and continue with instructions for [[manual:​installation:​install_from_packages:​debian_ubuntu#​importing_data|Debian/​Ubuntu]] or [[manual:​installation:​install_from_packages:​rhel_centos#​importing_data|RHEL/​CentOS]] to import the initial schema and data into the database.</​note>​ 
 + 
 +If you are installing Zabbix from sources, proceed to import the initial schema and data (assuming you are in the root directory of Zabbix sources):
  
   shell> cd database/​postgresql   shell> cd database/​postgresql
Line 51: Line 56:
  
 === TimescaleDB === === TimescaleDB ===
- 
-Support of TimescaleDB has been added on **experimental** basis in Zabbix 4.2.0. 
  
 <note warning>​Currently TimescaleDB is not supported by Zabbix proxy.</​note>​ <note warning>​Currently TimescaleDB is not supported by Zabbix proxy.</​note>​
  
-We assume that TimescaleDB extension has been already installed ​in the database (see [[https://​docs.timescale.com/​v1.1/​getting-started/​installation|installation instructions]]).+We assume that TimescaleDB extension has been already installed ​on the database ​server ​(see [[https://​docs.timescale.com/​latest/​getting-started/​installation|installation instructions]]).
  
 TimescaleDB extension must also be enabled for the specific DB by executing: TimescaleDB extension must also be enabled for the specific DB by executing:
Line 62: Line 65:
   echo "​CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"​ | sudo -u postgres psql zabbix   echo "​CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"​ | sudo -u postgres psql zabbix
  
-Running this command requires database administrator privileges. ​+Running this command requires database administrator privileges. 
 + 
 +<​note>​If you use a database schema other than '​public'​ you need to add a SCHEMA clause to the command above. E.g.:\\ ''​echo %%"​%%CREATE EXTENSION IF NOT EXISTS timescaledb SCHEMA yourschema CASCADE;​%%"​%% | sudo -u postgres psql zabbix''</​note>​
  
 The ''​timescaledb.sql''​ script is located in database/​postgresql. The script must be run after the regular PostgreSQL database has been created with initial schema/data (see section above): The ''​timescaledb.sql''​ script is located in database/​postgresql. The script must be run after the regular PostgreSQL database has been created with initial schema/data (see section above):
Line 109: Line 114:
   # stop here if you are creating database for Zabbix proxy   # stop here if you are creating database for Zabbix proxy
   shell> db2batch -d zabbix -f images.sql   shell> db2batch -d zabbix -f images.sql
-  shell> db2batch -d zabbix -f data.sql ​+  shell> db2batch -d zabbix -f data.sql ​-l ';;'​
  
 <​note>​It is important to set UTF-8 locale for Zabbix server, Zabbix proxy and the web server running Zabbix frontend. Otherwise text information from Zabbix will be interpreted by IBM DB2 server as non-UTF-8 and will be additionally converted on the way from Zabbix to the database and back. The database will store corrupted non-ASCII characters.</​note>​ <​note>​It is important to set UTF-8 locale for Zabbix server, Zabbix proxy and the web server running Zabbix frontend. Otherwise text information from Zabbix will be interpreted by IBM DB2 server as non-UTF-8 and will be additionally converted on the way from Zabbix to the database and back. The database will store corrupted non-ASCII characters.</​note>​