Hello,
you have some options,
- let each pi connect to the database and store the data. Databases can have multiple remote clients connected.
- send the data to a central pi. You could use MQTT to send/receive the data, using mosquitto as a MQTT broker.
The second option using MQTT would also allow to use other devices as e.g. arduino with ethernet/wifi to send data.
Hope this helps,
Gerhard