install_distributed
Differences
This shows you the differences between two versions of the page.
| install_distributed [2025/07/26 17:09] – - Imported by DokuWiki Advanced Plugin wikiadm | install_distributed [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Instalação distribuída ====== | ||
| - | ===== Cenário ===== | ||
| - | <file bash> | ||
| - | +-------------+ | ||
| - | | zbDB | ||
| - | |10.0.140.100 | | ||
| - | +-------------+ | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | |||
| - | ===== Criação das VMs no Vagrant ===== | ||
| - | |||
| - | <file ruby Vagrantfile> | ||
| - | # cat Vagrantfile | ||
| - | # -*- mode: ruby -*- | ||
| - | # vi: set ft=ruby : | ||
| - | |||
| - | ENV[' | ||
| - | |||
| - | Vagrant.configure(" | ||
| - | |||
| - | config.vm.define :zbDB do |zbDB| | ||
| - | zbDB.vm.network : | ||
| - | zbDB.vm.box = " | ||
| - | zbDB.vm.hostname = " | ||
| - | |||
| - | zbDB.vm.provider :libvirt do |lv| | ||
| - | lv.memory = 4096 | ||
| - | lv.cpus = 2 | ||
| - | lv.storage :file, :size => ' | ||
| - | end | ||
| - | end | ||
| - | |||
| - | config.vm.define :zbServer do |zbServer| | ||
| - | zbServer.vm.network : | ||
| - | zbServer.vm.box = " | ||
| - | zbServer.vm.hostname = " | ||
| - | |||
| - | zbServer.vm.provider :libvirt do |lv| | ||
| - | lv.memory = 4096 | ||
| - | lv.cpus = 2 | ||
| - | end | ||
| - | end | ||
| - | |||
| - | config.vm.define :zbFront do |zbFront| | ||
| - | zbFront.vm.network : | ||
| - | zbFront.vm.network : | ||
| - | zbFront.vm.box = " | ||
| - | zbFront.vm.hostname = " | ||
| - | |||
| - | zbFront.vm.provider :libvirt do |lv| | ||
| - | lv.memory = 2048 | ||
| - | lv.cpus = 2 | ||
| - | end | ||
| - | end | ||
| - | |||
| - | config.vm.define :zbProxy do |zbProxy| | ||
| - | zbProxy.vm.network : | ||
| - | zbProxy.vm.box = " | ||
| - | zbProxy.vm.hostname = " | ||
| - | |||
| - | zbProxy.vm.provider :libvirt do |lv| | ||
| - | lv.memory = 2048 | ||
| - | lv.cpus = 2 | ||
| - | end | ||
| - | end | ||
| - | |||
| - | config.vm.define :grafana do |grafana| | ||
| - | grafana.vm.network : | ||
| - | grafana.vm.box = " | ||
| - | grafana.vm.hostname = " | ||
| - | |||
| - | grafana.vm.provider :libvirt do |lv| | ||
| - | lv.memory = 2048 | ||
| - | lv.cpus = 2 | ||
| - | end | ||
| - | end | ||
| - | |||
| - | end | ||
| - | </ | ||
| - | |||
| - | ===== PGSQL ===== | ||
| - | ==== Instalação do PostgreSQL ==== | ||
| - | <file bash> | ||
| - | $ sudo dnf install https:// | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf repolist | ||
| - | Failed to set locale, defaulting to C.UTF-8 | ||
| - | repo id repo name | ||
| - | ol8_UEKR6 | ||
| - | ol8_appstream | ||
| - | ol8_baseos_latest | ||
| - | pgdg-common | ||
| - | pgdg10 | ||
| - | pgdg11 | ||
| - | pgdg12 | ||
| - | pgdg13 | ||
| - | pgdg14 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf module disable postgresql | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install postgresql13-server postgresql13-contrib | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo postgresql-13-setup initdb | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl enable --now postgresql-13 | ||
| - | </ | ||
| - | |||
| - | ==== Instalação da extensão TimescaleDB ==== | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo tee / | ||
| - | [timescale_timescaledb] | ||
| - | name=timescale_timescaledb | ||
| - | baseurl=https:// | ||
| - | repo_gpgcheck=1 | ||
| - | gpgcheck=0 | ||
| - | enabled=1 | ||
| - | gpgkey=https:// | ||
| - | sslverify=1 | ||
| - | sslcacert=/ | ||
| - | metadata_expire=300 | ||
| - | EOL | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install timescaledb-2-postgresql-13 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo timescaledb-tune --pg-config=/ | ||
| - | Using postgresql.conf at this path: | ||
| - | / | ||
| - | |||
| - | Is this correct? [(y)es/ | ||
| - | Writing backup to: | ||
| - | / | ||
| - | |||
| - | shared_preload_libraries needs to be updated | ||
| - | Current: | ||
| - | # | ||
| - | Recommended: | ||
| - | shared_preload_libraries = ' | ||
| - | Is this okay? [(y)es/ | ||
| - | success: shared_preload_libraries will be updated | ||
| - | |||
| - | Tune memory/ | ||
| - | Recommendations based on 3.56 GB of available memory and 2 CPUs for PostgreSQL 13 | ||
| - | |||
| - | Memory settings recommendations | ||
| - | Current: | ||
| - | shared_buffers = 128MB | ||
| - | # | ||
| - | # | ||
| - | #work_mem = 4MB | ||
| - | Recommended: | ||
| - | shared_buffers = 932011kB | ||
| - | effective_cache_size = 2730MB | ||
| - | maintenance_work_mem = 466005kB | ||
| - | work_mem = 9320kB | ||
| - | Is this okay? [(y)es/ | ||
| - | success: memory settings will be updated | ||
| - | |||
| - | Parallelism settings recommendations | ||
| - | Current: | ||
| - | missing: timescaledb.max_background_workers | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | Recommended: | ||
| - | timescaledb.max_background_workers = 8 | ||
| - | max_worker_processes = 13 | ||
| - | max_parallel_workers_per_gather = 1 | ||
| - | max_parallel_workers = 2 | ||
| - | Is this okay? [(y)es/ | ||
| - | success: parallelism settings will be updated | ||
| - | |||
| - | WAL settings recommendations | ||
| - | Current: | ||
| - | # | ||
| - | min_wal_size = 80MB | ||
| - | Recommended: | ||
| - | wal_buffers = 16MB | ||
| - | min_wal_size = 512MB | ||
| - | Is this okay? [(y)es/ | ||
| - | success: WAL settings will be updated | ||
| - | |||
| - | Miscellaneous settings recommendations | ||
| - | Current: | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | max_connections = 100 | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | Recommended: | ||
| - | default_statistics_target = 500 | ||
| - | random_page_cost = 1.1 | ||
| - | checkpoint_completion_target = 0.9 | ||
| - | max_connections = 50 | ||
| - | max_locks_per_transaction = 64 | ||
| - | autovacuum_max_workers = 10 | ||
| - | autovacuum_naptime = 10 | ||
| - | effective_io_concurrency = 256 | ||
| - | Is this okay? [(y)es/ | ||
| - | success: miscellaneous settings will be updated | ||
| - | Saving changes to: / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl restart postgresql-13 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl status postgresql-13 | ||
| - | ● postgresql-13.service - PostgreSQL 13 database server | ||
| - | | ||
| - | | ||
| - | Docs: https:// | ||
| - | Process: 6080 ExecStartPre=/ | ||
| - | Main PID: 6086 (postmaster) | ||
| - | Tasks: 9 (limit: 23062) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | Jul 08 20:17:19 pgsql systemd[1]: Starting PostgreSQL 13 database server... | ||
| - | Jul 08 20:17:19 pgsql postmaster[6086]: | ||
| - | Jul 08 20:17:19 pgsql postmaster[6086]: | ||
| - | Jul 08 20:17:19 pgsql systemd[1]: Started PostgreSQL 13 database server. | ||
| - | </ | ||
| - | |||
| - | ==== Preparando o volume para o banco zabbix ==== | ||
| - | <file bash> | ||
| - | $ sudo fdisk -l /dev/vdb | ||
| - | Disk /dev/vdb: 64 GiB, 68719476736 bytes, 134217728 sectors | ||
| - | Units: sectors of 1 * 512 = 512 bytes | ||
| - | Sector size (logical/ | ||
| - | I/O size (minimum/ | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo pvcreate /dev/vdb | ||
| - | $ sudo vgcreate vgPGSQL /dev/vdb | ||
| - | $ sudo lvcreate -L 32G -n lvZABBIX vgPGSQL | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo mkfs.xfs / | ||
| - | $ sudo mkdir -p / | ||
| - | $ sudo mount / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo blkid | egrep vg | ||
| - | / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ echo -e " | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo mount -a | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ mount | grep pgsql | ||
| - | / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ df -h | grep pgsql | ||
| - | / | ||
| - | </ | ||
| - | |||
| - | ==== Criando o banco e o acesso do zabbix ==== | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install policycoreutils-python-utils | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo chown postgres: | ||
| - | $ sudo semanage fcontext -a -t postgresql_db_t "/ | ||
| - | $ sudo restorecon -R -v / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo su - postgres | ||
| - | $ psql | ||
| - | # create tablespace tbZabbix location '/ | ||
| - | # create role zabbix login; | ||
| - | # \password zabbix | ||
| - | # create database zabbix owner zabbix tablespace tbZabbix; | ||
| - | # \db+ | ||
| - | | ||
| - | | ||
| - | | ||
| - | # \q | ||
| - | $ exit | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo vim / | ||
| - | [...] | ||
| - | # Acesso Zabbix | ||
| - | host zabbix | ||
| - | host zabbix | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo vim / | ||
| - | [...] | ||
| - | listen_addresses = ' | ||
| - | [...] | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl restart postgresql-13 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ psql -h 127.0.0.1 -U zabbix zabbix | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | zabbix=> create extension if not exists timescaledb cascade; | ||
| - | WARNING: | ||
| - | WELCOME TO | ||
| - | _____ _ | ||
| - | |_ | ||
| - | | | _ _ __ ___ | ||
| - | | | | | _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ | ||
| - | | | | | | | | | | __/\__ \ (_| (_| | | __/ |/ /| |_/ / | ||
| - | |_| |_|_| |_| |_|\___||___/ | ||
| - | | ||
| - | For more information on TimescaleDB, | ||
| - | |||
| - | 1. Getting started: https:// | ||
| - | 2. API reference documentation: | ||
| - | 3. How TimescaleDB is designed: https:// | ||
| - | |||
| - | Note: TimescaleDB collects anonymous reports to better understand and assist our users. | ||
| - | For more information and how to disable, please see our docs https:// | ||
| - | |||
| - | CREATE EXTENSION | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | zabbix=> \dx | ||
| - | List of installed extensions | ||
| - | Name | Version | | ||
| - | -------------+---------+------------+------------------------------------------------------------------- | ||
| - | | ||
| - | | ||
| - | (2 rows) | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo firewall-cmd --permanent --add-rich-rule 'rule family=" | ||
| - | $ sudo firewall-cmd --reload | ||
| - | </ | ||
| - | |||
| - | ===== Zabbix Server ===== | ||
| - | <file bash> | ||
| - | $ sudo rpm -Uvh https:// | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install zabbix-server-pgsql zabbix-agent2 zabbix-selinux-policy zabbix-sql-scripts postgresql | ||
| - | $ sudo dnf install net-snmp-utils net-snmp nmap tcpdump bind-utils traceroute | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ rpm -qil zabbix-sql-scripts-6.0.6-1.el8.noarch | ||
| - | Name : zabbix-sql-scripts | ||
| - | Version | ||
| - | Release | ||
| - | Architecture: | ||
| - | Install Date: Fri Jul 8 20:37:37 2022 | ||
| - | Group : Applications/ | ||
| - | Size : 8827042 | ||
| - | License | ||
| - | Signature | ||
| - | Source RPM : zabbix-6.0.6-1.el8.src.rpm | ||
| - | Build Date : Mon Jun 27 11:26:55 2022 | ||
| - | Build Host : d701cf2a492e | ||
| - | Relocations : (not relocatable) | ||
| - | URL : http:// | ||
| - | Summary | ||
| - | Description : | ||
| - | SQL files needed to setup Zabbix server or proxy databases | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ zcat / | ||
| - | $ psql -h 10.0.240.100 -U zabbix zabbix < / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | ]$ sudo cat / | ||
| - | LogFile=/ | ||
| - | LogFileSize=0 | ||
| - | PidFile=/ | ||
| - | SocketDir=/ | ||
| - | DBHost=10.0.240.100 | ||
| - | DBName=zabbix | ||
| - | DBUser=zabbix | ||
| - | DBPassword=zabbix | ||
| - | DBPort=5432 | ||
| - | SNMPTrapperFile=/ | ||
| - | Timeout=4 | ||
| - | LogSlowQueries=3000 | ||
| - | StatsAllowedIP=127.0.0.1 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl enable --now zabbix-server | ||
| - | $ sudo systemctl enable --now zabbix-agent2 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo firewall-cmd --permanent --add-rich-rule 'rule family=" | ||
| - | $ sudo firewall-cmd --permanent --add-rich-rule 'rule family=" | ||
| - | $ sudo firewall-cmd --reload | ||
| - | </ | ||
| - | |||
| - | ===== Zabbix Web ===== | ||
| - | <file bash> | ||
| - | $ sudo dnf install oraclelinux-developer-release-el8 oracle-instantclient-release-el8 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf module enable php:7.4 php-oci8 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo rpm -Uvh https:// | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install zabbix-web-pgsql zabbix-apache-conf zabbix-agent2 zabbix-selinux-policy | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl enable --now httpd | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo firewall-cmd --permanent --add-service=http | ||
| - | $ sudo firewall-cmd --reload | ||
| - | </ | ||
| - | |||
| - | {{: | ||
| - | |||
| - | {{: | ||
| - | |||
| - | {{: | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo vim / | ||
| - | [...] | ||
| - | // Uncomment and set to desired values to override Zabbix hostname/IP and port. | ||
| - | $ZBX_SERVER | ||
| - | $ZBX_SERVER_PORT | ||
| - | [...] | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl restart httpd | ||
| - | </ | ||
| - | |||
| - | ===== Zabbix Proxy ===== | ||
| - | <file bash> | ||
| - | $ sudo rpm -Uvh https:// | ||
| - | Retrieving https:// | ||
| - | warning: / | ||
| - | Verifying... | ||
| - | Preparing... | ||
| - | Updating / installing... | ||
| - | | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install zabbix-proxy-sqlite3 zabbix-agent2 zabbix-get zabbix-selinux-policy | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo dnf install net-snmp-utils net-snmp nmap tcpdump bind-utils traceroute | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo cat / | ||
| - | Server=10.0.240.110 | ||
| - | Hostname=zbProxy | ||
| - | LogFile=/ | ||
| - | LogFileSize=0 | ||
| - | PidFile=/ | ||
| - | SocketDir=/ | ||
| - | DBName=/ | ||
| - | DBUser=zabbix | ||
| - | SNMPTrapperFile=/ | ||
| - | Timeout=4 | ||
| - | LogSlowQueries=3000 | ||
| - | StatsAllowedIP=127.0.0.1 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo sed s/ | ||
| - | $ sudo setenforce 0 | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo mkdir / | ||
| - | $ sudo chown zabbix: | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo systemctl enable --now zabbix-porxy | ||
| - | $ sudo systemctl enable --now zabbix-agent2 | ||
| - | </ | ||
| - | ===== Grafana ===== | ||
| - | <code bash> | ||
| - | $ cat <<EOF | sudo tee / | ||
| - | [grafana] | ||
| - | name=grafana | ||
| - | baseurl=https:// | ||
| - | repo_gpgcheck=1 | ||
| - | enabled=1 | ||
| - | gpgcheck=1 | ||
| - | gpgkey=https:// | ||
| - | sslverify=1 | ||
| - | sslcacert=/ | ||
| - | EOF | ||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | $ sudo dnf update | ||
| - | $ sudo dnf search grafana | ||
| - | $ sudo dnf -y install grafana | ||
| - | $ sudo systemctl enable --now grafana-server.service | ||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | $ sudo firewall-cmd --permanent --add-rich-rule=' | ||
| - | $ sudo firewall-cmd --reload | ||
| - | $ sudo firewall-cmd --list-all | ||
| - | </ | ||
| - | ===== Referências ===== | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
install_distributed.1753560544.txt.gz · Last modified: by wikiadm
