New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prometheus: Update default tsdb path #15265
prometheus: Update default tsdb path #15265
Conversation
So /var is mounted in RAM, after every reboot your data would be lost. Having it in /data forces the user to think at least for a second on where to store things. Ideally on an external drive or USB stick, not so ideally in memory or some RPi flash chip. What do you think? |
Oh, I didn't know that The problem with Is it maybe possible to add a remark about that on the OpenWRT packages page, or name the dir something like Unless, |
Is it possible to document this quirk somehow, or am I missing some fundamental piece about OpenWRT? |
Is it not a better place like /srv/data ? |
So /var is mounted in /tmp and wiped every time you reboot. /srv sounds better to me, however I don't know how it's mounted at this point. |
/srv is default in rootfs, and may be switched by user in extroot or in any mountpoint... |
thanks @erdoukki , that makes sense, and I think I've done I've updated the path in PR to be in |
Please update me and I'll merge this. |
Just had time to boot up my installation and check: OpenWRT(+wulfy's) image:
So I attempted to configure it with I just realized that first message doesn't mention why it's fine for data to be in There's no such thing is So I'm thinking that instead of trying to figure out best place for user's data - maybe it's better to just document that by default installation is broken and users need to think and configure the package as they please? UPD: So, as a final touch - this is what I've done and it works as expected and survives reboots:
|
Why not doing these stuff in the install script ? |
The only con I see is that it'll be burning PRI's flash chip by default while being in /srv, unless users have exroot or external USB mounted over that path. Sounds good to me though, let me update the PR. UPD: Though, I'm not sure where's the install script lives 😅 |
I've pushed latest changes as per our discussion, but decided to create the directory if it doesn't exist on each prometheus service start. This way it'll be also properly handled for cases when you move data to a USB partition. (In fact, this is what prometheus tries to do currently, but fails because not having enough permissions. Here we create the dir as root and grant permissions to |
Use /srv/prometheus instead of /data, because user `prometheus` doens't have permissions to create `/data/` in `/`. Instead this commit puts prometheus data into `/srv/prometheus` by default, which is a cleaner path, and it'll create tsdb path & then assign required permissions on each prometheus service start. This way, also, the cases when users re-configure tsdb to point to external USB - it'll also be created and assigned required permissions for prometheus. Signed-off-by: Alex Simkin <sashasimkin@gmail.com>
I've fixed the requested changes - can you merge it 🙏 ? |
Use /var/prometheus-data instead of /data, because user
prometheus
doesn't have permissions to create directory in root filesystem, while it's totally fine to be in /varMaintainer: @aparcar
Compile tested: -
Run tested: linux/arm64, RaspberryPI4 model B, snapshot - by editing /etc/config/prometheus manually
Description: Use /var/prometheus-data instead of /data, because user prometheus doesn't have permissions to create directory in root filesystem, while it's totally fine to be in /var
related: #15236