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

mariadb galera: init at 25.3.23 #33176

Merged
merged 1 commit into from Jun 10, 2018
Merged

Conversation

Izorkin
Copy link
Contributor

@Izorkin Izorkin commented Dec 29, 2017

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@grahamc
Copy link
Member

grahamc commented Jan 5, 2018

@GrahamcOfBorg eval

@globin
Copy link
Member

globin commented Jan 5, 2018

I'm still unsure how this fits with the sentence on their webpage: https://downloads.mariadb.org/mariadb-galera/

There are no longer separate MariaDB Galera Cluster releases for MariaDB 10.1 and above. Simply download MariaDB (10.1 or above) and configure your cluster as normal.

@Izorkin
Copy link
Contributor Author

Izorkin commented Jan 5, 2018

This does not apply to source code. For work it is required to add a plug-in libgalera_smm.so in a config -
wsrep_provider=${pkgs.mariadb.galera}/lib/galera/libgalera_smm.so

@Izorkin
Copy link
Contributor Author

Izorkin commented Jan 7, 2018

When built from source, MariaDB includes wsrep patch, but does not include Galera (wsrep provider). In order to use Galera, one must build it separately. The process is detailed here: https://mariadb.com/kb/en/library/installating-galera-from-source/
In particular, it is said: "There are binary installation packages available for RPM and Debian-based distributions, which will pull in all required Galera dependencies. If these are not available, you will need to build Galera from source, as follows..."

@markus2342
Copy link
Contributor

The PR didn't build for us without the asio library. See mayflower@f3a391b for more.

Additionally we had problems with using galera when state transfers should be happening. It might not be relevant for this PR but we had to include several runtime dependencies for making the transfer scripts work. Unfortunately, the process still gets stuck on the receiving side of the state transfer when using mysqldump. We haven't found a solution for that yet.

@Izorkin
Copy link
Contributor Author

Izorkin commented Mar 28, 2018

markus2342, my worked config:

{ config, pkgs, ... }:
let
  mysqlenv-rsync       = pkgs.buildEnv { name = "mysql-path-env-rsync";       pathsToLink = [ "/bin" ]; paths = with pkgs; [ mariadb bash which gawk gnutar procps rsync lsof ]; };
  mysqlenv-mariabackup = pkgs.buildEnv { name = "mysql-path-env-mariabackup"; pathsToLink = [ "/bin" ]; paths = with pkgs; [ mariadb bash which gawk gnutar procps inetutils glibc.bin socat iproute pv openssl netcat inetutils ]; };
  mysqlenv-xtrabackup  = pkgs.buildEnv { name = "mysql-path-env-xtrabackup";  pathsToLink = [ "/bin" ]; paths = with pkgs; [ mariadb bash which gawk gnutar procps inetutils percona-xtrabackup socat iproute pv openssl netcat ]; };

in
{
  environment.systemPackages = with pkgs; [
    mariadb mariadb.client percona-xtrabackup
  ];

  systemd.services.mysql = with pkgs; {
    path = [ mysqlenv-xtrabackup ];
  };

  services.mysql = {
    enable = true;
    package = pkgs.mariadb;
    dataDir = "/var/data/db/mysql";
    extraOptions = ''
      bind-address = 0.0.0.0
      innodb_log_file_size = 128M
      innodb_file_per_table = 1
      character-set-server = utf8
      default-storage-engine = InnoDB
      wait_timeout = 600
      max_allowed_packet = 32M
      symbolic-links=0

      log-warnings = 2
      log_error = /var/data/db/logs/mysql_error.log
      slow_query_log_file = /var/data/db/logs/mysql_slow.log
      slow_query_log = 1
      long_query_time = 1

      query_cache_size = 24M
      query_cache_limit = 6MB
      key_buffer_size = 5M
      #key_cache_division_limit=70
      max_connections = 40
      max_heap_table_size = 290M
      tmp_table_size = 290M
      join_buffer_size = 3M
      table_open_cache = 600
      table_definition_cache = 600
      skip_name_resolve
      skip_host_cache

      [galera]
      wsrep_on=ON
      binlog_format=ROW
      innodb_autoinc_lock_mode=2
      innodb_locks_unsafe_for_binlog=1
      query_cache_size=0
      query_cache_type=0
      default_storage_engine=InnoDB
      innodb_log_file_size=128M
      innodb_file_per_table
      innodb_flush_log_at_trx_commit=2
      wsrep_provider=${pkgs.mariadb.galera}/lib/galera/libgalera_smm.so
      wsrep_cluster_address="gcomm://192.168.1.21,192.168.1.22,192.168.1.23"
      wsrep_cluster_name='galera_cluster'
      wsrep_node_address='192.168.1.21'
      wsrep_node_name='KVM-1'
      wsrep_sst_method=xtrabackup-v2
      wsrep_sst_auth=repl_user:user_repl
      wsrep_debug=ON

      [mysqld_safe]
      log-error = /var/data/db/logs/mysql_error.log

      [mysqldump]
      quick
      max_allowed_packet = 16M

      [myisamchk]
      key_buffer_size = 256M
      sort_buffer_size = 256M
      read_buffer = 2M
      write_buffer = 2M

      [mysqlhotcopy]
      interactive-timeout
    '';
  };
} 

Replication with mysqlenv-mariabackup not tested.
Packages mariadb.galera normal build, without asio library.

git:(8d6746a4bf4)# nix build -f ~/works/src_nix/nixpkgs_my mariadb.galera                                                                 
[3 built, 209 copied (914.4 MiB), 158.8 MiB DL]
time: 265

@Izorkin Izorkin changed the title mariadb galera: init at 25.3.22 mariadb galera: init at 25.3.23 Mar 28, 2018
@matthewbauer
Copy link
Member

Is this okay to merge?

@Izorkin
Copy link
Contributor Author

Izorkin commented Apr 9, 2018

How to need to merge?

@7c6f434c 7c6f434c merged commit d871acb into NixOS:master Jun 10, 2018
@Izorkin Izorkin deleted the mariadb-galera branch June 10, 2018 21:25
@Izorkin Izorkin restored the mariadb-galera branch June 10, 2018 21:58
@matthewbauer
Copy link
Member

This is breaking mariadb.x86_64-darwin:

https://hydra.nixos.org/build/75749129

@7c6f434c
Copy link
Member

Thanks, hopefully fixed in b4c38a5

@Izorkin
Copy link
Contributor Author

Izorkin commented Jun 11, 2018

To fix build need asio 1.10.8
#41822 and #41813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants