Skip to content
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

nixos/services.mysql: on service init check for galera cluster #381333

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

6543
Copy link
Member

@6543 6543 commented Feb 12, 2025

When you init a new galera cluster node, it still goes through the init process of the mariadb. but then it syncs while the systemd postStart script wants to do the last "first time inits".

this had trubled me a lot till i figured it out.

the workaround is to let it fail the first time then manually delete the /var/lib/mysql/mysql_init file.
but I think we can do better.

the error you get other wise on startup is:

Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 2 [Note] WSREP: ================================================
Feb 10 12:00:54 DB_1 mysql-start[19234]: View:
Feb 10 12:00:54 DB_1 mysql-start[19234]:   id: ab262b68-e4b4-11ef-b301-2fd85ce810cd:470347
Feb 10 12:00:54 DB_1 mysql-start[19234]:   status: primary
Feb 10 12:00:54 DB_1 mysql-start[19234]:   protocol_version: 4
Feb 10 12:00:54 DB_1 mysql-start[19234]:   capabilities: MULTI-MASTER, CERTIFICATION, PARALLEL_APPLYING, REPLAY, ISOLATION, PAUSE, CAUSAL_READ, INCREMENTAL_WS, UNORDERED, PREORDERED, STREAMING, NBO
Feb 10 12:00:54 DB_1 mysql-start[19234]:   final: no
Feb 10 12:00:54 DB_1 mysql-start[19234]:   own_index: -1
Feb 10 12:00:54 DB_1 mysql-start[19234]:   members(2):
Feb 10 12:00:54 DB_1 mysql-start[19234]:         0: 619b4ff6-e8d6-11ef-925d-36d7fe26bb65, DB_2
Feb 10 12:00:54 DB_1 mysql-start[19234]:         1: ee2b4268-e8d2-11ef-a96d-fb7373fb82b6, DB_3
Feb 10 12:00:54 DB_1 mysql-start[19234]: =================================================
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 2 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
Feb 10 12:00:54 DB_1 systemd-timesyncd[1067]: Network configuration changed, trying to establish connection.
Feb 10 12:00:54 DB_1 systemd-timesyncd[1067]: Network configuration changed, trying to establish connection.
Feb 10 12:00:54 DB_1 systemd-timesyncd[1067]: Contacted time server 193.203.3.170:123 (3.nixos.pool.ntp.org).
Feb 10 12:00:54 DB_1 mysql-post-start[19416]: /nix/store/s4i8abwx7ra38jwqwirxw7m2j6aw1jlk-mariadb-server-11.4.4/bin/mysql: Deprecated program name. It will be removed in a future release, use '/nix/store/s4i8abwx7ra38jwqwirxw7m2j6aw1jlk-mariadb-server-11.4.4/bin/mariadb' instead
Feb 10 12:00:54 DB_1 mysql-post-start[19416]: --------------
Feb 10 12:00:54 DB_1 mysql-post-start[19416]: CREATE USER IF NOT EXISTS 'mysql'@'localhost' IDENTIFIED WITH unix_socket
Feb 10 12:00:54 DB_1 mysql-post-start[19416]: --------------
Feb 10 12:00:54 DB_1 mysql-post-start[19416]: ERROR 1047 (08S01) at line 1: WSREP has not yet prepared node for application use
Feb 10 12:00:54 DB_1 systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] /nix/store/s4i8abwx7ra38jwqwirxw7m2j6aw1jlk-mariadb-server-11.4.4/bin/mysqld (initiated by: unknown): Normal shutdown
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: Shutdown replication
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: Server status change initialized -> disconnecting
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: Closing send monitor...
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: Closed send monitor.
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: gcomm: terminating thread
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: gcomm: joining thread
Feb 10 12:00:54 DB_1 mysql-start[19234]: 2025-02-12  2:00:54 0 [Note] WSREP: gcomm: closing backend

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Feb 12, 2025
@6543 6543 changed the title Services.mysql galera cluster new node init nixos/services.mysql: on service init check for galera cluster Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant