sipcapture / heplify-server

HEP Capture Server for HOMER
https://sipcapture.org
GNU Affero General Public License v3.0
183 stars 85 forks source link

DB not rotating #268

Closed Si-Richards closed 4 years ago

Si-Richards commented 4 years ago

I have homer7 on Centos 7 and the PostgreSQL 10 database server is not rotating. My understanding is that restarting Heplify server would drop old data but this is not happening...

My config looks like this:

HEPAddr = "0.0.0.0:9060" HEPTCPAddr = "" HEPTLSAddr = "0.0.0.0:9060" ESAddr = "" ESDiscovery = true LokiURL = "" LokiBulk = 200 LokiTimer = 4 LokiBuffer = 100000 LokiHEPFilter = [] ForceHEPPayload = [] PromAddr = "0.0.0.0:9096" PromTargetIP = "" PromTargetName = "" DBShema = "homer7" DBDriver = "postgres" DBAddr = "localhost:5432" DBUser = "homer" DBPass = "KP53S3eO721sFM30S4pL6mVPqo" DBDataTable = "homer_data" DBConfTable = "homer_config" DBBulk = 400 DBTimer = 4 DBBuffer = 400000 DBWorker = 8 DBRotate = true DBPartLog = "1h" DBPartSip = "1h" DBPartQos = "1h" DBDropDays = 1 DBDropOnStart = true Dedup = false DiscardMethod = [] AlegIDs = [] CustomHeader = [] LogDbg = "" LogLvl = "info" LogStd = false LogSys = false Config = "./heplify-server.toml" ConfigHTTPAddr = ""

lmangani commented 4 years ago

My understanding is that restarting Heplify server would drop old data but this is not happening...

Not sure where this is determined from. HEPlify-server needs to be running for rotation to take place and should remove data once it surpasses the configured age. Please share your config and results vs. expected results

Si-Richards commented 4 years ago

Heplify is running with the config above, even if i restart the service there is no drop.

My heplify log is:

2019-10-01T11:41:44+01:00 WARN pq: the database system is starting up 2019-10-01T11:43:36+01:00 INFO end creating tables (2019-10-01 11:43:36.991474764 +0100 BST m=+113.046494238) 2019-10-01T11:43:39+01:00 INFO postgres connection established 2019-10-01T11:43:39+01:00 ERR pq: could not extend file "base/16385/74378": No space left on device 2019-10-01T11:43:39+01:00 ERR pq: Could not complete operation in a failed transac

/opt/heplify-server# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 4903008 0 4903008 0% /dev tmpfs 4914756 0 4914756 0% /dev/shm tmpfs 4914756 8708 4906048 1% /run tmpfs 4914756 0 4914756 0% /sys/fs/cgroup /dev/mapper/centos-root 36678148 36678128 20 100% / /dev/sda1 1038336 236632 801704 23% /boot tmpfs 982952 0 982952 0% /run/user/0

negbie commented 4 years ago

Hi @Si-Richards , I see that you use the config option DBDropOnStart = true Indeed this means that tables older then DBDropDays = 1 should be deleted when you start heplify-server.

But from the latest log I see ERR pq: could not extend file "base/16385/74378": No space left on device It seems that you don't have room for vacuuming and thats why heplify-server fails to drop old partitions.

negbie commented 4 years ago

@Si-Richards were you able to solve this so I can close this issue?

negbie commented 4 years ago

No response->close.

Si-Richards commented 4 years ago

@Si-Richards were you able to solve this so I can close this issue?

Sorry for the lack of reply, we moved to Homer Legacy as it was not solved.

I've setup Homer7 again and still get the issue.....

Si-Richards commented 4 years ago

2019-12-03T09:49:33Z INFO start heplify-server 1.12 with config.HeplifyServer{HEPAddr:"0.0.0.0:9060", HEPTCPAddr:"", HEPTLSAddr:"0.0.0.0:9060", CGRAddr:"", ESAddr:"", ESDiscovery:true, ESUser:"", ESPass:"", LokiURL:"", LokiBulk:200, LokiTimer:4, LokiBuffer:100000, LokiHEPFilter:[]int{}, ForceHEPPayload:[]int{}, PromAddr:"0.0.0.0:9096", PromTargetIP:"", PromTargetName:"", DBShema:"homer7", DBDriver:"postgres", DBAddr:"localhost:5432", DBUser:"homer", DBPass:"DMK7VVhhweYANCCUvYXOwPaj6gI", DBDataTable:"homer_data", DBConfTable:"homer_config", DBBulk:200, DBTimer:4, DBBuffer:400000, DBWorker:8, DBRotate:true, DBPartLog:"2h", DBPartIsup:"6h", DBPartSip:"1h", DBPartQos:"6h", DBDropDays:1, DBDropDaysCall:1, DBDropDaysRegister:1, DBDropDaysDefault:1, DBDropOnStart:true, Dedup:false, DiscardMethod:[]string{}, AlegIDs:[]string{}, CustomHeader:[]string{}, LogDbg:"", LogLvl:"info", LogStd:false, LogSys:false, Config:"./heplify-server.toml", ConfigHTTPAddr:"", ConfigHTTPPW:""}

2019-12-03T09:49:33Z INFO expose metrics without or unbalanced targets 2019-12-03T09:49:33Z INFO start creating tables (2019-12-03 09:49:33.162173299 +0000 GMT m=+0.012348456)

2019-12-03T09:49:33Z WARN dial tcp [::1]:5432: connect: connection refused 2019-12-03T09:49:33Z WARN dial tcp [::1]:5432: connect: connection refused

lmangani commented 4 years ago

Postgres is unreachable based on the error message alone. How are you setting up the system?

Si-Richards commented 4 years ago

Hi Imangani,

This time i am using your script for centos7 (https://github.com/sipcapture/homer-installer/tree/7.7) It's strange because yes i can see that the partition is 100% from df -h. If i restart posgres and heplify services then Homer has completed a clean up and i am now only 28% used but i had to force this with the restart.

BTW, the UI looks really good now!

Si-Richards commented 4 years ago

so as a hackey work around i have a cronjob to restart the services each day.

hbokh commented 4 years ago

--- cut --- DBUser:"homer", DBPass:"DMK7VVhhweYANCCUvYXOwPaj6gI", DBDataTable:"homer_data", DBConfTable:"homer_config" --- cut ---

@Si-Richards I suggest you change the database password too.. 😇

Si-Richards commented 4 years ago

--- cut --- DBUser:"homer", DBPass:"DMK7VVhhweYANCCUvYXOwPaj6gI", DBDataTable:"homer_data", DBConfTable:"homer_config" --- cut ---

@Si-Richards I suggest you change the database password too.. 😇

Thats a fair point......

Si-Richards commented 4 years ago

As a side note i looked at the rotator code as i really need to rotate after 12hrs as i'm collecting over 50Gb a day.

Shame there isnt a way to force a shorter rotate

negbie commented 4 years ago

Feel free to do a PR and when you are doing it please feel free to add some tests for it too. Thanks!

negbie commented 4 years ago

Btw. my gradma is using usb sticks bigger than 50GB :D

negbie commented 4 years ago

So what I want to say is that I see no sense in implementing this myself. I mean 100GB a day what is this? 3TB a month, common thats nothing ;)