Weather Software > WeeWX Software

How to migrate WeeWX database?

(1/1)

stromb0li:
Hey WXForum,

Is there any documentation on redeploying WeeWX from scratch, but retaining historical data?

I've been running WeeWX for about 3-4 years now and have absolutely loved it, however, when I originally setup WeeWX, I put it on a machine that is nearly 15 years old now and I think it's finally time to change it out of rotation.  I'd like to completely redeploy WeeWX with factory defaults, but would like to keep my historical data that I've collected the past few years if possible as well.

Thank you!

Gyvate:
In the simplest case, you just do a clean new install (re-using your old weewx.conf and all modifications you may have made to skin.conf and *.inc and index.html.tmpl from the /etc/weewx/skins/YourSkin directory - YourSkin could be Seasons or whichever skin you use). Make sure that the database schema used in the new installation is the same as in the old one.
################################################ weewx.conf ##############################

#   This section binds a data store to a database.

[DataBindings]

    [[wx_binding]]
        # The database must match one of the sections in [Databases].
        # This is likely to be the only option you would want to change.
        database = archive_sqlite
        # The name of the table within the database
        table_name = archive
        # The manager handles aggregation of data for historical summaries
        manager = weewx.manager.DaySummaryManager
        # The schema defines the structure of the database.
        # It is *only* used when the database is created.
        schema = schemas.wview_extended.schema

##############################################################################


Once the new weewx (e.g. 4.5.1) is running properly for the first time (syslog shows a proper archiving entry), stop weewx and copy your old weewx.sdb into the directory where your weewx database resides (e.g. /var/lib/weewx - the path will depend on your installation method - see weewx WIKI/documentation) overwriting your "test"/first install database . Then restart weewx and that's it.

that's for a sqlite database, but for a mySQL database the procedure should be analogous. With a mySQL database you might need to export your data from the old and import them again into your new one. See weewx tools in the weewx documentation (www.weewx.com/docs.html)

You can avoid data loss by installing weewx on your new server (e.g. RPi4) and copy the database over from your old (still running) installation in the archiving window (usually 300 seconds = 5 minutes; but may be different in your setup).

stromb0li:
Ended up copying /var/lib/weewx/weewx.sdb from the older machine and writting over the top of the one on the new machine.  Worked perfect! :P  Thanks!

Navigation

[0] Message Index

Go to full version