Is there a database built into the base system
Karl Young
karly at kipshouse.org
Thu Apr 6 21:33:21 UTC 2017
Ernie Luzar(luzar722 at gmail.com)@2017.04.06 17:14:40 -0400:
> Steve O'Hara-Smith wrote:
> >On Thu, 06 Apr 2017 16:00:25 -0400
> >Ernie Luzar <luzar722 at gmail.com> wrote:
> >
> >>Chuck Swiger wrote:
> >>>On Apr 6, 2017, at 12:27 PM, Ernie Luzar <luzar722 at gmail.com> wrote:
> >>>>Looking for a simple database thats comes with the base system, is
> >>>>there one?
> >>>There's likely an old flavor of BerkeleyDB around if you just need a
> >>>key-value store.
> >>>
> >>>If you're looking for a SQL database, start with SQLite (cf
> >>>databases/sqlite3 port), and then look towards MySQL or Postgres.
> >>>
> >>>Regards,
> >>BerkeleyDB sounds like something to look at. Did a "locate
> >>Berkeley" cmd and nothing popped out. Is it called something
> >>else?
> >
> > man db
> >
> > Will get you all the details.
> >
> >>Writing csh scripts manipulating text files containing lists of
> >>IP address. Don't want any port as a required dependent. I
> >>though I
> >
> > Hmm Berkeley DB is a C API so perhaps not so convenient in csh,
> >what do you want a database to do for you ?
> >
>
> Here is the project description. analyze the unsolicited traffic
> hitting my front door to determine if the same source ip address is
> cycling through a range of ip address on a hourly, daily, weekly
> basis. My test box ipfilter firewall uses "keep state" on everything
> that is allowed out. Nothing is allowed in. Using ipfilter ippool
> in-core ip address table to capture count of times said unsolicited
> inbound source ip address hits my front door. Have 3 flat text files
> containing about 2000 ip address having a record size of 30 bytes.
> I am afraid I may be approaching the max file size that csh can handle.
> Thinking of simple db where the 3 files are indexed and can be
> read/written with out sequentially process all the records. At the
> proof of concept stage.
>
> I have programmed in pear script before where I can open a file and
> process a record sequentially where only the next record is
> buffered. csh does not have that kind of file handling that I know
> of.
>
> You have any suggestions?
I'd suggest, Python, Perl, TCL, Ruby, ... anything but csh (or bash) for
a job like this.
I know Python has BDB support:
https://docs.python.org/2/library/bsddb.html
I'm sure all the other languages you might want to use will have support
for BDB, or sqlite.
Although reading and writing a 60K csv file probably isn't that big a
deal, unless you're doing it quite often. In Python you could import a
CSV file into a dictionary, which makes lookup very fast.
-karl
More information about the freebsd-questions
mailing list