http://qs321.pair.com?node_id=11118515


in reply to Re^12: Help with Geo::IP output
in thread Help with Geo::IP output

The config file (geoip.rc) wasn't read because of permission. It was 644 but it must be 600 - sought help from the hosting.

I finally managed to create the geoip.gb file with the total size of 510,100,144 (someone posted this size too) so I think the db is complete. I say this because when I ran the --fetch command, there was no success message when it ended:

user@myhost ~]$ geoip --fetch --DB=dbi:SQLite:dbname=geoip.db 2020-06-22 19:16:39 4689345 GeoLite2-ASN-CSV.zip 304 2020-06-22 19:16:39 4689345 GeoLite2-ASN-CSV.zip 2020-06-16 11:13:32 1805947 GeoLite2-Country-CSV.zip 304 2020-06-16 11:13:32 1805947 GeoLite2-Country-CSV.zip 2020-06-16 11:19:50 41827687 GeoLite2-City-CSV.zip 304 2020-06-16 11:19:50 41827687 GeoLite2-City-CSV.zip Reading City info ... Reading City IPv4 info .. user@myhost ~]$

So I thought I should be able to run the command below now that the geoip.db is set up:

[user@myhost ~]$ geoip -w 103.2.106.33 FATAL: no pg_hba.conf entry for host "[local]", user "user", database + "geoip", SSL off Cannot continue without a working database

What am I still missing?

Replies are listed 'Best First'.
Re^14: Help with Geo::IP output
by Corion (Pope) on Jun 25, 2020 at 11:39 UTC

    pg_hba.conf sounds like Postgres, but geoip --fetch --DB=dbi:SQLite:dbname=geoip.db sounds like SQLite.

    Maybe you need to make both consistent?

Re^14: Help with Geo::IP output
by marto (Cardinal) on Jun 25, 2020 at 11:38 UTC

    In the create example you provided a dsn, which worked. When you ran it again you didn't so the program has no idea where to look (you didn't tell it, and haven't got an entry in your config file), and once again, the default is Pg. Just add the dsn to your config file.

      THANK YOU SO MUCH marto!

      I had thought it wouldn't be possible to get this geoip thing to work - there were so many things missing in the puzzle:

      1) The default SQLite was 2013 version and I had no idea this could be an issue. Had to download the source and compile my own binaries.

      2) I didn't have DBD::SQLite installed until someone mentioned it.

      3) Then there was the config file which I didn't now I could get - thought it was only for paid users.

      4) And then there was the memory usage thing at the server end that stopped the --fetch processes because it was using too much RAM (someone did warn about this). The hosting made an exception for an hour to allow the command to run.

      So it was an not *easy thing* to do especially for someone not too familiar with Unix.

      But it's finally done now - thank you everyone for your patience and help. Thank you.

        All kinds of suggestions now committed. Note all the errors in the command line and how you get feedback:

        1. Nonexistent driver (type in driver name). You get the same error if you typed it correctly but the driver cannot load for whatever reason:

          $ perl ./geoip --no-fetch --DB=dbi:SQXLite:dbname=geoip.db Cannot continue without a working database Did you forget to install DBD::SQXLite?
        2. The dbx: part won't ever find a (standard) driver, so
        3. $ perl ./geoip --no-fetch -DB=dbx:SQLite:dbname=geoip.db Cannot continue without a working database Maybe the matching DBD for dbx:SQLite:dbname=geoip.db is not insta +lled

        I also made a few adjustments to the documentation based on marto's feedback. Thank you!

        (FWIW I have no idea what the errors will be if the machine does not have enough memory to create the database)

        Note that if you fetch new data files, you will need the memory again to load/update the database.

        For normal operation (--no-fetch) you don't need that much memory.


        Enjoy, Have FUN! H.Merijn

        You didn't have to do 1., simply installing DBD::SQLite (cpanm DBD::SQLite) builds SQLite for you: "DBD::SQLite is a Perl DBI driver for SQLite, that includes the entire thing in the distribution. So in order to get a fast transaction capable RDBMS working for your perl project you simply have to install this module, and nothing else.". From there it's a case of installing the app (cpanm App::geoip), and creating a config file with the details as specified. So the following steps:

        • Read and understand the module documentation.
        • Build SQLite and the perl module DBD::SQLite: cpanm DBD::SQLite.
        • Install geoip: cpanm App::geoip.
        • Create your config file as specified in the documentation.
        • Run the app and create the database: geoip --fetch --DB=dbi:SQLite:dbname=geoip.db

        I've made a note to review the module docs in light of this thread, and if I can come up with any improvement I'll raise with Tux and see what he thinks.