-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mdev 5536 systemd socket activation notification #26
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
Mdev 5536 systemd socket activation notification #26
Conversation
Add systemd detection (autoenabled) and configuration option. Enable systemd for debian and ubuntu
mysql_socket_fd mirrors the functionality of mysql_socket_socket. Needed for systemd socket activation.
This adds systemd socket activation functionality to MariaDB where the system libraries exist for it. When started from init scripts mysqld functions the same as it does before this patch. When systemd socket activation starts mysqld, systemd does the listening and leaves these listening file descriptors open. Assisted by sd_listen_fds, the sockets are populated into arrays. Configuration options ignored by mysqld when instigated from systemd socket activation include: * bind-address * port * extra-port * socket * skip-networking * max-connections Systemd socket activation definations (e.g. support-files/mariadb.socket) provide an arbitary number of sockets for MariaDB to listen on. 10 was chosen as an arbitary number bigger than the currently supported 2 TCP ports and one unix socket for the maximium number supported. The support-files/mariadb-socket-convert script can be used to convert my.cnf files and extract the needed config files to create a mariadb.socket file. The functionalty provided by extra_port isn't supported on MariaDB under socket activation as all sockets are treated equal. support-files/mariadb.service provides a systemd service file. This replaces mysqld_safe. Inside this file there are examples on how to replace specific mysqld_safe variables.
Add systemd notification for long and intrustive innodb events to report to systemd status monitoring'
To extend the number of status messages available to innodb moved the sd_notifyf into ib_logf. Suggested by Jan Lindstrom.
|
Please note that buf_dump_status does not use ib_logf currently, instead fprintf directly. |
|
@janlindstrom d0619cd too invasive? could boost it with asserts that enum status_severity enumberations match ib_log_level_t |
handing missing /usr/bin/host executable Default to *:ports if can't resolve bindaddress Comment why we put and empty ListenStream= line
Only give "STATUS=No listening sockets" when there are no systemd sockets activated and systemd sockets where provided.
result of set global innodb_buffer_pool_dump_now=ON; before: 2015-03-15 16:46:34 7fba7effd700150315 16:46:34 [Warning] InnoDB: Dumping buffer pool(s) to .//ib_buffer_pool 150315 16:46:34 [Note] InnoDB: Dumping buffer pool 1/1, page 1/154 150315 16:46:34 [Note] InnoDB: Dumping buffer pool 1/1, page 129/154 2015-03-15 16:46:34 7fba7effd700150315 16:46:34 [Warning] InnoDB: Buffer pool(s) dump completed at 150315 16:46:34 after: 150315 16:57:45 [Warning] InnoDB: Dumping buffer pool(s) to .//ib_buffer_pool 150315 16:57:45 [Note] InnoDB: Dumping buffer pool 1/1, page 1/154 150315 16:57:45 [Note] InnoDB: Dumping buffer pool 1/1, page 129/154 150315 16:57:45 [Warning] InnoDB: Buffer pool(s) dump completed at 150315 16:57:45
no
hadn't tested it. Have tested now - cleaned up as per f7aad0b. |
|
The support-files/mariadb-systemd-start file should be removed as it is a security hazard. The init system should not automatically create the database. This should be left up to the machine's administrator. As the mysql_install_db script opens a password-less root user, this is unsafe. https://bugs.gentoo.org/show_bug.cgi?id=483526 shows a discussion from Gentoo's change of manual systemd integration by our distro. |
|
@grknight , thanks so much for looking a this. I've looked at at the gentoo scripts/service files. I quite like the idea of the mysqld_at service and will probably incorporate its concepts into whatever is accepted as the single instance version. Is a passwordless root the only concern? Its a good point. As an alternative I'm thinking about having unix_socket plugin installed by default and root@localhost via unix_socket as the default grant, passwordless yes, but can only be accessed via the unix root user. Its the way the current debian/ubuntu packages are (though it seems to have some packaging problems - might be my error there). With socket activation (main benefit I see is more flexible network configuration, easy early runtime dependencies, and systemd restart on process dying), is mariadb-socket-convert sufficient? Should I be trying to script the migration of less used mysqld_safe options to their equivalent (as per mariadb.service)? |
|
On 4/29/2015 2:19 AM, Daniel Black wrote:
Yes that is a concern. unix_socket also can cause a confusion of users
Systemd's Socket activation is not right for MariaDB IMO. I know that XtraDB/InnoDB can be faster in recent times to recover, but Also, socket activation + full SST with galera may not be pretty since |
|
On 22 May 2015 at 00:46, Brian Evans [email protected] wrote:
This is getting off topic for this PR.
You may be misunderstand the role that systemd socket activation plays. I
Believe me I know, I work on some fairly large systems. Also, socket activation + full SST with galera may not be pretty since
As noted in the MDEVs there is more work to do with galera. Its not too |
configure.cmake
Outdated
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.
I'd prefer three-value option, YES/NO/AUTO, with AUTO being the default.
…rom systemd notify
…te option to scripts/mysqld_safe.sh
…all) - leave this to distro maintainers
|
Did the clean ups. 10.0 work stalled at the thought of including systemd notify_* function into mariadb. Will need to purge out the socket activation and enhance mariadb-service-convert to port port/socket options too attempted to create a 10.1 merge however it seemed to encompase everything from 10.0 that hasn't yet been merged to 10.1 https://github.com/MariaDB/server/compare/10.1...openquery:MDEV-5536-systemd-socket-activation-notification-10.1?expand=1 Where do you met to go from here? |
I'm a bit confused at this comment. I don't see why you would stop running the service as |
Quite right. I though from the comments in on of the MDEV it was ignored when socket activation was used but yes I will keep it the same. I can't add a dependency on libsystemd-daemon0 in a stable branch, even if compile time configurable(?), So at the moment I've got to rebase/merge this for 10.1 and/or remove socket activation and include the sd_notify calls from libsystemd-daemon0 in 10.0. And a bit more testing just to be sure - especially on packaging changes. |
|
I'm sorry, but I don't quite understand the state of this PR. You've created #83 for 10.1, fine. Is this one still for 10.0? Or is it obsolete and should be closed? |
|
can be closed.
|
Issue 25: Different functions for Treeherder prod and stage
Adds system functionality to mariadb including socket activation and notification.