feat: Add daemon mode support for standalone command #7331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR adds daemon mode support for the GreptimeDB standalone command, allowing users to run the database in the background using the --daemon or -d flag. This enhancement improves the usability of GreptimeDB on ARM64 boards or edge devices, enabling it to run independently of shell sessions, enhancing its resilience and availability.
Implementation details
Modified files :
Key changes :
Usage example :
Problem solved
When running GreptimeDB in standalone mode on environments like ARM64 boards or edge devices, the process currently depends on the shell session that started it. If the user disconnects (e.g., network cable removed or SSH session closed), the GreptimeDB process exits.
This PR addresses this issue by adding a built-in daemon mode, allowing GreptimeDB to continue running in the background independently of the user session, making it more robust and user-friendly for embedded or self-hosted setups.
Benefits
Testing
The implementation has been successfully compiled with cargo build --bin greptime and follows the project's code style and error handling patterns. It maintains compatibility with existing functionality while adding the new daemon mode feature.
Future enhancements
Potential future improvements could include:
This change aligns with GreptimeDB's goal of being a robust and user-friendly database for edge and cloud environments, making it more suitable for deployment in resource-constrained devices and embedded systems.