Back in 2016, WeeWx murdered one of my many Raspberry Pi 3’s… all because it kept throwing loop and archive data bits into the database…. on the pi. Oops.
Here in 2019, as of this writing, the mySQL database has 1,130,399 rows logged, with various bits of data logged, totalling about 408MB. I was a numpty however, and was not logging the real time data properly since 2016… doh! That was fixed early-on in 2019. Realtime data table and associated rows is already huge – 7,130,258 rows huge, or about 1.4GB!!
Lesson learned however, SD Cards do not make for a good means of storage for databases… especially a database that constantly is reading and writing.
You’re literally and legitimately better off, right off the get go, forcing weewx to use a database servers that does NOT reside on a raspberry pi’s storage device… or any sort of device that uses a SD Card, it does a fair amount of reads and writes, and not just down to the database i/o, but image and web page generation!
Moving along, for me, I currently use mySQL for WeeWx – it gets the job done. On first start of weewx, it will always attempt to use a SQLite database file-ball on the pi, we don’t want that!
Assuming you’ve been following the direction of the official documentation at WeeWx.com ( http://www.weewx.com/docs/usersguide.htm#configuring_mysql ), let’s go ahead and force WeeWx to ignore that local sqlite database and use mySQL only, on another servers!
Load up /etc/weewx/weewx.conf
in your favorite plain text editor (I use nano on the SSH terminal, and Notepad++ on desktop – depends on how much I want to self-torture my mind).
Added below is an example configuration segment to weewx.conf
, this goes above and before the [Engine]
clause. The mySQL Table in the SQL daemon is weewx
, the IP or hostname needs to be set where it says IP.IP.IP.IP, same goes for the username and password.
[StdArchive] archive_interval = 60 archive_delay = 1 record_generation = hardware loop_hilo = True data_binding = wx_binding [DataBindings] [[wx_binding]] database = archive_mysql table_name = archive manager = weewx.wxmanager.WXDaySummaryManager schema = schemas.wview.schema [Databases] [[archive_mysql]] database_type = mysql database_name = weewx [DatabaseTypes] [[mysql]] driver = weedb.mysql host = IP.IP.IP.IP user = mySQL_WeeWx_UserName password = mySQL_WeeWx_PassWord
Note in the configuration segment above, there is absolutely NO mention of sqlite… anywhere. It’s just mySQL, on a remote server – as it should be.
Save the weewx.conf file, restart weewx, monitor the /var/log/messages or /var/log/syslog (tail -f /var/log/messages /var/log/syslog
) files for any issues.
NOTE: Run the tail command from another terminal so you can continue doing your modifications on the original terminal window.