[ZBXNEXT-1603] ability to use frontend and API with read-only DB Created: 2013 Feb 01  Updated: 2023 Jul 20

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Kodai Terashima Assignee: Unassigned
Resolution: Unresolved Votes: 22
Labels: database, frontend, performance, readonly, replicatedDB, scalability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBXNEXT-3442 Ability to set readonly flag for DB Closed

 Description   

Having a feature that frontend and API can be used with read-only DB is helpful for off-load a database. For example, Zabbix server process and normal frontend work with master DB, and select-only frontend work with slave (read-only) DB (only viewing trigger and event status, values, graphs).



 Comments   
Comment by Oleksii Zagorskyi [ 2016 Sep 16 ]

ZBXNEXT-3442 shows proof of concept and contains some patch.

Comment by Dmitry Verkhoturov [ 2016 Sep 16 ]

Patches for 2.4 and 3.0 are published in zabbix-patches github repo, feel free to use them: https://github.com/zabbix/zabbix-patches

Comment by Vaclav Medek [ 2016 Oct 27 ]

Hi,
I tried to apply patch, but now I got timeout after login
Apache log: [Thu Oct 27 16:14:52.122871 2016] [:error] [pid 1074] [client 127.0.0.1:52080] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /usr/share/zabbix/include/func.inc.php on line 1919, referer: http://localhost/zabbix/index.php

before patch error was :
error">pg_query(): Query failed: ERROR: Slony-I: Table ids is replicated and cannot be modified on a subscriber node - role=0 [index.php:117 ->; CView->;render() -> include() -> require_once() -> CProfile::flush() -> CProfile::insertDB() -> get_dbid() -> DBexecute() -> pg_query() in /usr/share/zabbix/include/db.inc.php:531].....

running on version 2.4.8, PostgreSQL replicated by Slony

Comment by Dmitry Verkhoturov [ 2016 Oct 27 ]

vmedek, I'm afraid my solution won't fit you because in my case Zabbix still modifies few tables, like 'sessions'.

Comment by Vaclav Medek [ 2016 Oct 31 ]

Thanks Dimitry for your hint. I made tables 'sessions', 'profiles' and 'user_history' r/w (and removed them from replication) and everything works now.

Comment by Bartlomiej Kos [ 2019 Oct 24 ]

Hello,

It would be great if such functionality for the front-end would could be made official - like for example allowing to configure two databases for the front-end in zabbix.conf.php, where all the write queries would go to the master database and all the read queries would go to the slave database, and if the slave database is gone, all would go to the master. I realise this is not perfect and does not cover all corner cases (e.g. slave DB working fine but replication had stopped, etc.) but it would still be a great addition to the front-end's capabilities in a "use only if you know what you are doing" category.

Generated at Sat Apr 20 15:38:28 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.