archiver-appliance / epicsarchiverap

This is an implementation of an archiver for EPICS control systems that aims to archive millions of PVs.
Other
38 stars 37 forks source link

Persist with sqlite #128

Closed mdavidsaver closed 1 year ago

mdavidsaver commented 2 years ago

Persistence using sqlite as an alternative to mysql/mariadb. The only differences are the syntax of a non-standard UPSERT operation, and the date/time format of the last_modified column.

Needs https://github.com/xerial/sqlite-jdbc in the class path.

In context.xml

<Resource name="jdbc/archappl"
        auth="Container"
        type="javax.sql.DataSource"
        driverClassName="org.sqlite.JDBC"
        url="jdbc:sqlite:/path/to/appl.db"
        factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
 />

Note that sqlite requires both the DB file, and the containing directory, to be writable.

Initialize with

sqlite3 /path/to/appl.db -init /path/to/archappl_sqlite.sql
mdavidsaver commented 2 years ago

@slacmshankar is this a change you would be interested/willing to merge?

I've been running a (very small) AA instance with this for a couple of months now. It has restarted a couple of times without incident. The only issue I've observed is the hazelcast Partition does not have an owner error I mention by email.

mdavidsaver commented 1 year ago

Rebased. My test install is still running well. No further hazelcast errors observed.