Open liamjamesfoy opened 8 years ago
A couple of reasons other than permissions. It could be that the data is missing or the db file is corrupted. Also, make sure no other process is using the database file, that could be the issue as well.
You can try running tokyo's db command tcamgr
against the db file and see its output:
tcamgr inform /tmp/9mdb_datamap.tcb
or to list all the keys
tcamgr list /tmp/9mdb_datamap.tcb
➜ /tmp: tcamgr inform /tmp/9mdb_datamap.tcb path: /tmp/9mdb_datamap.tcb database type: B+ tree database record number: 0 size: 266752 ➜ /tmp: tcamgr list /tmp/9mdb_datamap.tcb
Not sure if this helps. Checked that their was no other running process too.
Anything else I can help with?
tcamgr list /tmp/9mdb_datamap.tcb
Returned nothing by the way.
thank you,
Interesting, the only thing I can think about would be the db file being corrupted (which is very unusual according to tokyo's docs). How many records did you persist? You could also try copying those files into a local machine (assuming same arch) and see how that goes.
Thank you for your reply.
The odd thing is I've never created the database. Is this something I should have done? This has happened from the initial starting of the program from installation.
Should a DB be created on its own?
Thank you,
That's definitely odd. Yes, the database is created upon starting the program (if goaccess was configured with --enable-tcb=btree). Can you try specifying a different directory instead of /tmp? You can run it as:
goaccess -f access.log --db-path=/home/user/some_path --keep-db-files
BTW, what version of OpenBSD are you running?
This is an up to date OpenBSD 5.8 installation using the stable port.
➜ li git:() /home/li: goaccess -f access.log --db-path=/home/li/ --keep-db-files
GoAccess - version 0.9.7 - May 27 2016 21:40:44 Config file: /etc/goaccess.conf
Fatal error has occurred Error occured at: /usr/ports/pobj/goaccess-0.9.7/goaccess-0.9.7/src/tcabdb.c - tc_adb_create - 110 Unable to open an abstract database: /home/li/9mdb_uniqmap.tcb#lcnum=1024#ncnum=512#lmemb=128#nmemb=256#bnum=32749#opts=l#mode=wct
➜ li git:() /home/li:
The port is built with --enable-tcb=btree - I have checked. Odd one. Is there anything I can do to help you?
Thanks,
Thanks for posting this. Would you be able to run the following code just to narrow down the issue.
gcc -I/usr/local/include sample.c -L/usr/local/lib -ltokyocabinet -lz -lbz2 -lrt -lpthread -lm -lc
sample.c
#include <tcutil.h>
#include <tcadb.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
int main(int argc, char **argv){
TCADB *adb;
char *key, *value;
/* create the object */
adb = tcadbnew();
/* open the database */
if(!tcadbopen(adb, "casket.tcb")){
fprintf(stderr, "open error\n");
}
/* store records */
if(!tcadbput2(adb, "foo", "hop") ||
!tcadbput2(adb, "bar", "step") ||
!tcadbput2(adb, "baz", "jump")){
fprintf(stderr, "put error\n");
}
/* retrieve records */
value = tcadbget2(adb, "foo");
if(value){
printf("%s\n", value);
free(value);
} else {
fprintf(stderr, "get error\n");
}
/* traverse records */
tcadbiterinit(adb);
while((key = tcadbiternext2(adb)) != NULL){
value = tcadbget2(adb, key);
if(value){
printf("%s:%s\n", key, value);
free(value);
}
free(key);
}
/* close the database */
if(!tcadbclose(adb)){
fprintf(stderr, "close error\n");
}
/* delete the object */
tcadbdel(adb);
return 0;
}
➜ li git:() /home/li: ./a.out
hop
bar:step
baz:jump
foo:hop
I bet you didn't expert to see that :) odd..
Is it something to do with the file path?
OK, I was able to replicate this on OpenBSD 5.9. I'll see what's going on and post back. Thanks again.
BTW, in the mean time, and if needed, you could build from source which uses the default storage:
$ wget http://tar.goaccess.io/goaccess-0.9.8.tar.gz
$ tar -xzvf goaccess-0.9.8.tar.gz
$ cd goaccess-0.9.8/
$ ./configure
$ make
# make install
Yes - the default storage is working fine :). Please let me know when you find the issue.
Thank you for taking the time to help and respond.
OK. I know what's going on in here. OpenBSD 5.9 has a default open file descriptor of 128. Tokyo's cabinet on-disk b-tree needs a db file per storage, so goaccess creates a db file per metric/per panel for a total of ~188 db files. To see current limit, use ulimit -a
.
A possible solution for this would be to use one db file per metric for all panels, which would be about 12 files, though, this would need a refactor and could slow down the parsing process, depending on the table size.
Or even better and if your data-set fits in memory, build goaccess without btree and use the default in-memory storage (no dependencies).
A workaround for the on-disk storage is to increase this number in your machine,
- Edit /etc/login.conf and make sure the
openfiles-cur
limits are set to a larger number than it currently is, e.g., 256.- Then logout and relogin to your system and you should be able to do:
- Use
ulimit -n 256
to set the maximum number of open files.
GoAccess should run at this point.
I just tripped over an installation on CentOS 7
:
GoAccess - version 1.2 - Jul 23 2017 03:05:48
Config file: /etc/goaccess.conf
Fatal error has occurred
Error occured at: src/tcabdb.c - tc_adb_create - 119
Unable to open an abstract database: /tmp/-1mdb_agent_keys.tcb#lcnum=1024#ncnum=512#lmemb=128#nmemb=256#bnum=32749#opts=l#mode=wct
Any suggestions?
@daBee have you tried if running the above works? I'm not sure if this will ever get fixed as goaccess is moving to a different on-disk storage.
@allinurl Yes. It was a permissions issue. CentOS 7
parks the logs behind permissions only root
can see, so I had to cron
an rsync
to something local, then do the same to my workstation where goaccess
performs on that second copy. So, it's fixed for now. Beta testing this setup, moving to weekly reports Sunday morning.
Not sure what you mean about the 'movement' you mentioned. Can you point me in the right direction where I can read about this? Cheers
@daBee Glad you got it to work. The current on-disk storage is being replaced to a different storage as it has given some issues. No docs yet as this is in the works. Stay tuned.
Saw this issue recently on CentOS 7.7 that I had to run a script that used goaccess with sudo
where I had previously not run under sudo
.
Hi,
This isn't a permission issue - not sure what the issue is...
I understand I'm a version behind but this is a production machine and I don't want to mess around with the port files for this release.
No problem if you can't help :-)
OpenBSD 5.8 GENERIC.MP#0 amd64
Error: