Compare commits
10 Commits
11_0_0-9_e
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c310fbff74 | ||
![]() |
17c47013a1 | ||
cd59e93ccb | |||
87537e32b8 | |||
037347ecaa | |||
7d26d7368d | |||
b3e9d320f3 | |||
e78f90c5e5 | |||
2d41a90503 | |||
93c2c06fff |
@@ -1 +0,0 @@
|
||||
sme10
|
28
createlinks
28
createlinks
@@ -3,12 +3,21 @@
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
# we add few link fromn old mysql things to mariadb things
|
||||
safe_symlink("/usr/bin/mariadb-dump","root/usr/bin/mysqldump");
|
||||
safe_symlink("/usr/bin/mariadb-dumpslow","root/usr/bin/mysqldumpslow");
|
||||
safe_symlink("/usr/bin/mariadb-check","root/usr/bin/mysqlcheck");
|
||||
safe_symlink("/usr/bin/mariadb-admin","root/usr/bin/mysqladmin");
|
||||
safe_symlink("/usr/bin/mariadb-show","root/usr/bin/mysqlshow");
|
||||
safe_symlink("/usr/bin/mariadb-upgrade","root/usr/bin/mysql_upgrade");
|
||||
# some are provided by MariaDB-client-compat
|
||||
#safe_symlink("/usr/bin/mariadb-dump","root/usr/bin/mysqldump");
|
||||
#safe_symlink("/usr/bin/mariadb-dumpslow","root/usr/bin/mysqldumpslow");
|
||||
#safe_symlink("/usr/bin/mariadb-check","root/usr/bin/mysqlcheck");
|
||||
#safe_symlink("/usr/bin/mariadb-admin","root/usr/bin/mysqladmin");
|
||||
#safe_symlink("/usr/bin/mariadb-show","root/usr/bin/mysqlshow");
|
||||
#safe_symlink("/usr/bin/mariadb-upgrade","root/usr/bin/mysql_upgrade");
|
||||
#safe_symlink("/usr/bin/mariadb","root/usr/bin/mysql");
|
||||
#safe_symlink("/usr/bin/mariadb-access","root/usr/bin/mysqlaccess");
|
||||
#safe_symlink("/usr/bin/mariadb-binlog","root/usr/bin/mysqlbinlog");
|
||||
#safe_symlink("/usr/bin/mariadb-convert-table-format","root/usr/bin/mysql_convert_table_format");
|
||||
#safe_symlink("/usr/bin/mariadb-find-rows","root/usr/bin/mysql_find_rows");
|
||||
#safe_symlink("/usr/bin/mariadb-fix-extensions","root/usr/bin/mysql_fix_extensions");
|
||||
#safe_symlink("/usr/bin/mariadb-install-db","root/usr/bin/mysql_install_db");
|
||||
#safe_symlink("/usr/bin/mariadb-embedded","root/usr/bin/mysql_embedded");
|
||||
|
||||
#--------------------------------------------------
|
||||
# pre-backup actions
|
||||
@@ -72,6 +81,13 @@ foreach (qw(
|
||||
templates2events("$_", $event);
|
||||
}
|
||||
|
||||
#--------------------------------------------------
|
||||
# actions for post-install event
|
||||
#--------------------------------------------------
|
||||
$event = "post-install";
|
||||
|
||||
event_link("mysql-update-innodb-page-size", $event, "03");
|
||||
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/rsyslog");
|
||||
|
@@ -18,12 +18,12 @@ onfailure () {
|
||||
echo $message | /usr/bin/mail -s "error on backup of $db MariaDB database" admin
|
||||
fi
|
||||
message="$message \nThere was an error trying to dump database $db, please check for table errors in this db. Forcing a backup of the corrupted DB."
|
||||
mysqldump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2
|
||||
mariadb-dump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2
|
||||
if [ "$fixtables" = "enabled" ]; then
|
||||
repair="failure"
|
||||
message="$message \nTrying to auto-repair the db and do a backup after..."
|
||||
mysqlcheck -s --auto-repair -c "$db" && \
|
||||
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump && repair="success"
|
||||
mariadb-check -s --auto-repair -c "$db" && \
|
||||
mariadb-dump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump && repair="success"
|
||||
message="$message \n => $repair"
|
||||
fi
|
||||
echo $message
|
||||
@@ -37,17 +37,18 @@ then
|
||||
fi
|
||||
for db in $(mysql -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$")
|
||||
do
|
||||
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump || onfailure $db
|
||||
mariadb-dump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump || onfailure $db
|
||||
done
|
||||
# double usage as already in mysql.dump
|
||||
# dump user privileges
|
||||
mysqldump --system=users --insert-ignore > /home/e-smith/db/mysql/mysql.privileges.dump
|
||||
#mariadb-dump --system=users --insert-ignore > /home/e-smith/db/mysql/mysql.privileges.dump
|
||||
# dump plugins
|
||||
mysqldump --system=plugins --insert-ignore > /home/e-smith/db/mysql/mysql.plugins.dump
|
||||
#mariadb-dump --system=plugins --insert-ignore > /home/e-smith/db/mysql/mysql.plugins.dump
|
||||
# dump udfs
|
||||
mysqldump --system=udfs --insert-ignore > /home/e-smith/db/mysql/mysql.udfs.dump
|
||||
#mariadb-dump --system=udfs --insert-ignore > /home/e-smith/db/mysql/mysql.udfs.dump
|
||||
# dump servers
|
||||
mysqldump --system=servers --insert-ignore > /home/e-smith/db/mysql/mysql.servers.dump
|
||||
#mariadb-dump --system=servers --insert-ignore > /home/e-smith/db/mysql/mysql.servers.dump
|
||||
# dump stats
|
||||
mysqldump --system=stats --insert-ignore > /home/e-smith/db/mysql/mysql.stats.dump
|
||||
#mariadb-dump --system=stats --insert-ignore > /home/e-smith/db/mysql/mysql.stats.dump
|
||||
# dump timezones
|
||||
mysqldump --system=timezones --insert-ignore > /home/e-smith/db/mysql/mysql.timezones.dump
|
||||
#mariadb-dump --system=timezones --insert-ignore > /home/e-smith/db/mysql/mysql.timezones.dump
|
||||
|
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
event=$1
|
||||
# check event is defined or return
|
||||
[[ -z "$event" ]] && exit 0
|
||||
# check we run as post-install event or return
|
||||
[[ "$event" == "post-install" ]] || exit 0
|
||||
# check mariadb is not running or return
|
||||
/usr/bin/pgrep mariadbd && exit 0
|
||||
# ONLY delete the mysql data dirictory if it is initial state
|
||||
# we assume if only mysql, test, sys and performance_schema this is the case
|
||||
validdirs="/var/lib/mysql/mysql/ /var/lib/mysql/performance_schema/ /var/lib/mysql/sys/ /var/lib/mysql/test/"
|
||||
for dir in $(ls -d /var/lib/mysql/*/) ; do
|
||||
[[ $(echo ${validdirs} | grep ${dir}) ]] || exit 0
|
||||
done
|
||||
|
||||
# we should be safe to reset dir content
|
||||
# we use find as glob will ignore dot starting filename
|
||||
# rm -rf /var/lib/mysql/*
|
||||
find /var/lib/mysql -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf
|
||||
exit 0
|
||||
|
@@ -2,9 +2,11 @@
|
||||
|
||||
# we need to filter out mysql.user table from older mariadb and from mysql
|
||||
# in SME10 we added for migration creation of mysql.privileges.dump with mariadb 10.5 and newer syntax
|
||||
( /usr/bin/mysql_filter_user_table /home/e-smith/db/mysql/mysql.dump ;
|
||||
# non RH ocmpiled version of mariadb limits MyISAM index to 1000 bytes, newer mysql db use Aria as engine for those tables
|
||||
( /usr/bin/mysql_filter_user_table /home/e-smith/db/mysql/mysql.dump |sed -e 's/ENGINE=MyISAM/ENGINE=Aria/';
|
||||
[ -f /home/e-smith/db/mysql/mysql.privileges.dump ] && cat /home/e-smith/db/mysql/mysql.privileges.dump;
|
||||
cat /var/lib/mysql.private/set.password ) | mysql || exit 1
|
||||
cat /var/lib/mysql.private/set.password ) | mariadb || exit 1
|
||||
/usr/bin/mariadb-upgrade
|
||||
/bin/rm /run/mariadb/mariadb.pid
|
||||
/usr/bin/systemctl restart mariadb.service
|
||||
for i in $(seq 1 20);
|
||||
@@ -12,11 +14,11 @@ do
|
||||
if [ -f /run/mariadb/mariadb.pid ]
|
||||
then
|
||||
/bin/rm /home/e-smith/db/mysql/mysql.dump
|
||||
[ -f /home/e-smith/db/mysql/mysql.privileges.dump ] /bin/rm /home/e-smith/db/mysql/mysql.privileges.dump
|
||||
[ -f /home/e-smith/db/mysql/mysql.privileges.dump ] && /bin/rm /home/e-smith/db/mysql/mysql.privileges.dump
|
||||
exit 0
|
||||
fi
|
||||
echo waiting for mysqld to restart
|
||||
echo waiting for mariadb to restart
|
||||
sleep 1
|
||||
done
|
||||
echo mysqld failed to restart
|
||||
echo mariadb failed to restart
|
||||
exit 1
|
||||
|
@@ -2,4 +2,9 @@
|
||||
#innodb
|
||||
{# enabled is already the default
|
||||
}innodb_file_per_table={ $mariadb{'innodb_file_per_table'}||'1' }
|
||||
# innodb_strict_mode = 0
|
||||
# higher size see SME 12982
|
||||
innodb_page_size=64k
|
||||
innodb_log_buffer_size={ $mariadb{'innodb_log_buffer_size='}||'32M' }
|
||||
innodb_buffer_pool_size={ $mariadb{'innodb_buffer_pool_size'}||'512M' }
|
||||
|
||||
|
@@ -4,6 +4,14 @@
|
||||
my $pw = esmith::util::LdapPassword();
|
||||
|
||||
$OUT .= "use mysql;\n";
|
||||
$OUT .= "SET PASSWORD FOR 'root'\@localhost = PASSWORD(\"$pw\"); \n";
|
||||
$OUT .= "FLUSH PRIVILEGES;\n";
|
||||
$OUT .= "CREATE OR REPLACE USER 'root'\@localhost IDENTIFIED VIA unix_socket OR mysql_native_password USING PASSWORD(\"$pw\"); \n";
|
||||
$OUT .= "GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION; \n";
|
||||
$OUT .= "FLUSH PRIVILEGES;\n";
|
||||
# will not work as requires the With_grant privilege.... but accepts second line to alter the table to give it...
|
||||
#$OUT .= "GRANT PROXY ON ``@`` TO `root`\@localhost WITH GRANT OPTION;\n";
|
||||
$OUT .= "REPLACE INTO `proxies_priv` (`Host`, `User`, `Proxied_host`, `Proxied_user`, `With_grant`, `Grantor`, `Timestamp`) VALUES
|
||||
('localhost', 'root', '', '', 1, '', current_timestamp()),
|
||||
('$SystemName.$DomainName', 'root', '', '', 1, '', current_timestamp());\n";
|
||||
$OUT .= "FLUSH PRIVILEGES;\n";
|
||||
}
|
||||
|
@@ -41,8 +41,8 @@ if ( ($runlevel ne 'multi-user.target' && $runlevel ne "sme-server.target") ||
|
||||
{
|
||||
# Find our mysqld binary
|
||||
my $mysqld = "/usr/libexec/mysqld";
|
||||
if (-f "/usr/sbin/mysqld") {
|
||||
$mysqld = "/usr/sbin/mysqld";
|
||||
if (-f "/usr/sbin/mariadbd") {
|
||||
$mysqld = "/usr/sbin/mariadbd";
|
||||
}
|
||||
# Hard-code user, since it is set in mysqld_safe currently.
|
||||
# See http://bugs.mysql.com/2163
|
||||
|
@@ -3,9 +3,13 @@
|
||||
exec 2>&1
|
||||
if [ ! -f /var/lib/mysql/mysql/user.frm ]
|
||||
then
|
||||
setuidgid mysql sh /usr/bin/mysql_install_db --rpm --skip-test-db --user=mysql --group=mysql
|
||||
setuidgid mysql sh /usr/bin/mariadb-install-db --rpm --skip-test-db --user=mysql --group=mysql
|
||||
if [ -f /home/e-smith/db/mysql/mysql.dump ]
|
||||
then
|
||||
/sbin/e-smith/expand-template /etc/e-smith/sql/init/00_restore_dumped_dbs
|
||||
fi
|
||||
fi
|
||||
|
||||
# set root password and access to socket passwordless
|
||||
/usr/sbin/mariadbd --socket=/var/lib/mysql/mysql.sock --bootstrap --user=mysql < /var/lib/mysql.private/set.password
|
||||
exit 0
|
||||
|
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in $(seq 1 20);
|
||||
do
|
||||
if [ -S /var/lib/mysql/mysql.sock ]
|
||||
then
|
||||
/usr/bin/mysql < /var/lib/mysql.private/set.password
|
||||
echo "root password set"
|
||||
exit 0
|
||||
fi
|
||||
echo waiting for mariadb to start to set root password
|
||||
sleep 1
|
||||
done
|
||||
echo failed to set root password
|
||||
# we fail silently, mariadb will still work, only issue is for phpmyadmin
|
||||
# and non socket access
|
||||
exit 0
|
||||
|
@@ -46,13 +46,13 @@ do
|
||||
F=$(basename $link | sed 's/S\?[0-9][0-9]_\?//')
|
||||
case $F in
|
||||
*.sql)
|
||||
action "Loading $F into mysql" perl -e '
|
||||
action "Loading $F into mariadb" perl -e '
|
||||
open (STDERR, "|/usr/bin/logger -p local1.info -t mysql.init");
|
||||
open (STDOUT, ">&STDERR");
|
||||
exec "/usr/bin/mysql";' < $link && /bin/rm $link
|
||||
exec "/usr/bin/mariadb";' < $link && /bin/rm $link
|
||||
;;
|
||||
*)
|
||||
action "Loading $F into mysql" perl -e '
|
||||
action "Loading $F into mariadb" perl -e '
|
||||
open (STDERR, "|/usr/bin/logger -p local1.info -t mysql.init");
|
||||
open (STDOUT, ">&STDERR");
|
||||
exec shift; ' $link && /bin/rm $link
|
||||
|
@@ -18,7 +18,6 @@ ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
|
||||
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
|
||||
|
||||
#ours : we need root user as + and ! are not yet supported
|
||||
#ExecStartPre=/usr/libexec/mysql-check-socket
|
||||
ExecStartPre=-/sbin/e-smith/service-status mariadb
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /var/lib/mysql.private/set.password
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /root/.my.cnf
|
||||
@@ -36,8 +35,6 @@ ExecStart=/usr/sbin/mariadbd \
|
||||
--user=mysql \
|
||||
--pid-file=/run/mariadb/mariadb.pid
|
||||
|
||||
ExecStartPost=-/sbin/e-smith/systemd/mariadb-post
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
|
||||
|
@@ -2,7 +2,7 @@ Summary: Koozali SME Server specific mysql configuration and templates.
|
||||
%define name smeserver-mysql
|
||||
Name: %{name}
|
||||
%define version 11.0.0
|
||||
%define release 9
|
||||
%define release 18
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
@@ -36,6 +36,8 @@ Requires: MariaDB-gssapi-server
|
||||
# not available after 10.x
|
||||
#Requires: MariaDB-compat
|
||||
Requires: mariadb-common ,mariadb-errmsg,mariadb-server-utils
|
||||
Requires: MariaDB-client-compat
|
||||
Requires: MariaDB-server-compat
|
||||
|
||||
AutoReqProv: no
|
||||
|
||||
@@ -79,7 +81,29 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root)
|
||||
|
||||
%changelog
|
||||
* Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
|
||||
* Mon Jul 21 2025 Trevor Batley <trevor@batley.id.au> 11.0.0-18.sme
|
||||
- add fix to allow upgrade of innodb to new pagesize as required by 12982 on install [SME: 13083]
|
||||
|
||||
* Thu Jun 05 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-17.sme
|
||||
- fix conflict with MariaDB-server-compat [SME: 13024]
|
||||
|
||||
* Wed May 14 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-16.sme
|
||||
- fix conflict with MariaDB-client-compat [SME: 13005]
|
||||
|
||||
* Sun Apr 20 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-15.sme
|
||||
- set innodb_page_size=64k [SME: 12982]
|
||||
breaking change, needs backup and restore of mariadb databases
|
||||
- convert mysql* bins call to mariadb-* [SME: 12983]
|
||||
- revert [SME: 12591]
|
||||
|
||||
* Sun Apr 06 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-13.sme
|
||||
- fix Specified key was too long with older mysql db tables [SME: 12980]
|
||||
added back mysql_upgrade in 00_restore_dumped_dbs
|
||||
|
||||
* Fri Apr 04 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-12.sme
|
||||
- restore root user, pasword and socket login [SME: 12978]
|
||||
|
||||
* Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
|
||||
- upgrade to support mariadb 11.4 [SME: 12930]
|
||||
move mariadb-upgrade to mysql.init unit
|
||||
remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
|
||||
|
Reference in New Issue
Block a user