Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^10: Help with Geo::IP output

by hippo (Chancellor)
on Jun 24, 2020 at 17:21 UTC ( #11118449=note: print w/replies, xml ) Need Help??


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

What does the config file look like?

It looks exactly as described in the documentation.

Examples of DSNs are given in the DBD::SQLite docs.

Replies are listed 'Best First'.
Re^11: Help with Geo::IP output
by Anonymous Monk on Jun 24, 2020 at 21:26 UTC

    So I need to create an SQLite database called geoip?

      $ geoip -Ddsn dbi:SQLite:geoip -w 103.2.106.33 Cannot continue without a working database

      I created an SQLite database named "geoip" and then called geoip as shown above. It says "Cannot continue without a working database".

        Can you please indicate what is unclear in the README?

        $ perl ./geoip --fetch --DB=dbi:SQLite:dbname=geoip.db

        Will do everything for you if you have a working DBD::SQLite.

        A demo:

        $ ls -l geoip.db /bin/ls: cannot access 'geoip.db': No such file or directory Exit 2

        Be patient on the next one, it'll take a while to finish (my demo took 5 minutes). You will need enough memory and disk space. My process took 13 Gb of ram.

        $ perl ./geoip --fetch --DB=dbi:SQLite:dbname=geoip.db Create table stamps Create table continent Create table country Create table ipv4 Create table provider Create table city Create table ipc4 2020-06-22 21:16:39 4689345 GeoLite2-ASN-CSV.zip 304 2020-06-22 21:16:39 4689345 GeoLite2-ASN-CSV.zip 2020-06-16 13:13:32 1805947 GeoLite2-Country-CSV.zip 304 2020-06-16 13:13:32 1805947 GeoLite2-Country-CSV.zip 2020-06-16 13:19:50 41827687 GeoLite2-City-CSV.zip 304 2020-06-16 13:19:50 41827687 GeoLite2-City-CSV.zip Reading Country info ... Reading Country IPv4 info ... Reading Provider IPv4 info ... Reading City info ... Reading City IPv4 info ...
        $ ls -l geoip.db -rw-r--r-- 1 501100544 Jun 25 00:30 geoip.db

        So there you go, 501 Mb of SQLite database.


        Enjoy, Have FUN! H.Merijn
        geoip -Ddsn dbi:SQLite:geoip -w 103.2.106.33

        That's not how to specify the DSN on the command line.

        $ geoip -Ddbi:SQLite:geoip -w 103.2.106.33

        might get you farther but since you haven't detailed how you created the database, who can say?

        Ensure you have DBD::SQLite installed (cpan DBD::SQLite or cpanm DBD::SQLite), ensure your maxmind licence key is valid and listed in the config file, from the command line run:

        geoip --fetch --DB=dbi:SQLite:dbname=geoip.db

        The program will create a new database called geoip.db, create the required schema and populate it with the data from maxmind.

        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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118449]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2020-09-22 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (129 votes). Check out past polls.

    Notices?