-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zero downtime update #713
Merged
Merged
Zero downtime update #713
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kenhys
force-pushed
the
feature-nodowntime
branch
2 times, most recently
from
November 19, 2024 07:53
91799bd
to
112d5c5
Compare
3 tasks
daipom
force-pushed
the
feature-nodowntime
branch
from
November 29, 2024 04:30
303e0b1
to
6f781e5
Compare
daipom
force-pushed
the
feature-nodowntime
branch
4 times, most recently
from
December 6, 2024 07:09
2ee719f
to
e5a6e5a
Compare
deb: * preinst: detect locally installed plugins * collect plugin information via fluent-diagtool * postinst: install locally installed plugins * if network access is denied, giving up install plugins rpm: * %pre $1 == 2 (upgrade): detect locally installed plugins * collect plugin information via fluent-diagtool * %post $1 == 2 (upgrade): install locally installed plugins * if network access is denied, giving up install plugins Signed-off-by: Kentaro Hayashi <[email protected]>
auto: Automatically restart service without downtime. service restart will be fired during %preun (upgrade). manual: Manually restart service by user. If user select manual, suppress auto-restart with automatically generated service hook %post and %systemd_postun_with_restart. when downgrading from v6, use manual and uninstall v6 then reinstall v5. Signed-off-by: Kentaro Hayashi <[email protected]>
Accidentally debug print in preinst was pushed in 26785ce. Signed-off-by: Kentaro Hayashi <[email protected]>
When upgrading package, the following hook is executed: plugins should be installed before restarting service. Before: * old prerm * new preinst collect plugin information * old postrm auto restart * new postinst install plugins After: * old prerm collect plugin information * new preinst * old postrm * new postinst install plugins and auto restart Signed-off-by: Kentaro Hayashi <[email protected]>
fluentd_auto_restart will be launched during "configure" phase, so there is no need to check that action. This is occurred by migrating restart logic from postrm to postinst. Signed-off-by: Kentaro Hayashi <[email protected]>
Signed-off-by: Shizuo Fujita <[email protected]>
… focal Signed-off-by: Shizuo Fujita <[email protected]>
Signed-off-by: Shizuo Fujita <[email protected]>
Signed-off-by: Shizuo Fujita <[email protected]>
To verify major upgrade in workflow, it needs more package build time. Signed-off-by: Kentaro Hayashi <[email protected]>
Signed-off-by: Kentaro Hayashi <[email protected]>
This PR adds testing to ensure that package upgrades succeed without data loss. At present, the following plugins will be checked: - in_tcp - in_udp - in_syslog Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]>
Before: * missing fluent-plugin was installed After: * missing fluent-plugin was installed * missing dependency gem was also installed NOTE: * if missing gem requires development packages to build it, it will fail. * fluent-diagtool depends on highly systemd service, so it is simple just to use fluent-gem detecting missing gems. --------- Signed-off-by: Kentaro Hayashi <[email protected]>
add test to update with auto / manual feature. Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]>
Even though needrestart package was installed, service will not be restarted out of the maintainer script (hook). Signed-off-by: Kentaro Hayashi <[email protected]>
Signed-off-by: Shizuo Fujita <[email protected]>
Update the test to ensure : * There is no issue even if an upgrade is performed that includes a Ruby major version update. * There is no data loss even if data is sent until the main process is replaced. --------- Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]>
Signed-off-by: Shizuo Fujita <[email protected]>
Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Kentaro Hayashi <[email protected]>
This PR will allow to switch auto/manual restart settings with DEB package even when Fluentd is running. --------- Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]>
Signed-off-by: Daijiro Fukuda <[email protected]>
daipom
force-pushed
the
feature-nodowntime
branch
from
December 10, 2024 01:25
685ba07
to
55c021b
Compare
Add missing `prerm` script to include it in debian package Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]>
This allows users to manually manage plugins by setting FLUENT_PACKAGE_SERVICE_RESTART to manual. For example, there will be cases where a user wants to use a particular plugin version. Signed-off-by: Daijiro Fukuda <[email protected]>
…l phase (#758) We were going to support two methods of downgrading with zero downtime. 1. Running v6.x => Install v5.x package by overwriting 2. Running v6.x => Replace `FLUENT_PACKAGE_SERVICE_RESTART` value to `manual` => uninstall v6.x => Install v5.x The second method is to keep the Fluentd process running after uninstalling it. We decided to remove `2.` method because it may cause confusion for users. Signed-off-by: Shizuo Fujita <[email protected]>
daipom
force-pushed
the
feature-nodowntime
branch
from
December 10, 2024 01:26
55c021b
to
4fed1fe
Compare
We don't need to suppress this macro because this macro handles preset, not restart. I have confirmed that this macro of the package for RHEL 9 is expanded as follows. ```bash if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then # Initial installation /usr/lib/systemd/systemd-update-helper install-system-units fluentd.service || : fi ``` Signed-off-by: Daijiro Fukuda <[email protected]>
…#761) Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Daijiro Fukuda <[email protected]>
Merged
Points * FROM-package just leaves tmp files if it supports the features. * TO-package trigger the features if there are those tmp files. * Thus, we don't need to check the version. * Make installing plugin and restarting the same condition. Before 1. from-prerm(upgrade): Do nothing. 2. to-preinst(upgrade): Collect plugin-list. Confirm version. 3. Install TO-package 4. from-postrm(upgrade): Do nothing. 5. Uninstall FROM-package 6. to-postinst(configure): Install plugin and restart if need. After 1. from-prerm(upgrade): * Check auto or not. * Leave plugin-list and pid if need. 2. to-preinst(upgrade): Set tmp files for TO-package. 3. Install TO-package 4. from-postrm(upgrade): Clean tmp files of FROM-package. 5. Uninstall FROM-package 6. to-postinst(configure): Install plugin and restart if need. Signed-off-by: Daijiro Fukuda <[email protected]>
Points * FROM-package just leaves tmp files if it supports the features. * TO-package trigger the features if there are those tmp files. * Thus, can ensure that both FROM and TO support the feature. * Make installing plugin and restarting the same condition. * Disable `%systemd_postun_with_restart` completely to align specifications with DEB. Before 1. to-pre(2): Collect plugin-list. 2. Install TO-package 3. to-post(2): Install plugin. 4. from-preun(1): Do nothing. 5. Uninstall FROM-package 6. from-postun(1): Restart if need. After 1. to-pre(2): Collect plugin-list. 2. Install TO-package 3. to-post(2): Do nothing. 4. from-preun(1): * Check auto or not. * Leave plugin-install flag and pid if need. 5. Uninstall FROM-package 6. from-postun(1): Disable `%systemd_postun_with_restart`. 7. to-posttrans: Install plugin and restart if need. Signed-off-by: Daijiro Fukuda <[email protected]>
) Signed-off-by: Kentaro Hayashi <[email protected]>
kenhys
force-pushed
the
feature-nodowntime
branch
from
December 11, 2024 11:33
7e511e9
to
33c1c1c
Compare
Fixed DCO. |
kenhys
approved these changes
Dec 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
All checks has passed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This changes the behavior when an update is performed while the service is active by using Fluentd's new feature: the zero downtime restart.
If you stop the service before the update, it will not be affected.
Change of specification:
FLUENT_PACKAGE_SERVICE_RESTART
environmental variableChanges auto restart conditions for update
RPM:
FLUENT_PACKAGE_SERVICE_RESTART
setting isauto
(default).DEB:
Adds
FLUENT_PACKAGE_SERVICE_RESTART
environmental variableWe can set this in the following file.
/etc/sysconfig/fluentd
/etc/default/fluentd
Value:
auto
(default):Automate plugin install for update on demand
for details.manual
:SIGUSR2
to the supervisor process.systemctl restart
.Automate plugin install for update on demand
When the service automatically restarts with the zero downtime restart feature, the missing plugins are automatically detected and reinstalled before restarting.
Previously, an automatic restart after the update was not recommended because it is problematic.
If you install some plugins manually, you need to reinstall plugins before restarting when the version of the embedded Ruby is updated.
So, for automatic restart, this feature provides automatic plugin installation.
This works as follows:
fluent-plugin-
.If you need to manage plugins manually, please set
FLUENT_PACKAGE_SERVICE_RESTART
tomanual
. (Ex. fixing the versions, offline environment, ...)Then, automatic plugin installing and restarting are disabled.
You can manually install plugins and send
SIGUSR2
signal to activate the zero downtime restart feature after update.Caution: if you use a custom unit file, need to migrate it to use this feature safely
If you use a custom unit file, such as
/etc/systemd/system/fluentd.service
, please remove these 2 lines.We don't need
GEM_HOME
andGEM_PATH
.They will be removed after v5.2.0, but if you use a custom unit file, you need to remove them manually.
If these variables are set, the zero downtime restart feature may not work correctly.
It is because the new process inherits the original environment variables if using this feature.
Mechanism of automatic restart with zero downtime
RPM
%systemd_postun_with_restart
.SIGUSR2
if need.DEB
SIGUSR2
if need.