Skip to content

Commit

Permalink
my.cnf should be provided on all distros.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniyPatlan committed Sep 8, 2016
1 parent f185e2b commit 05a0358
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build-ps/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Section: database
Architecture: any
Pre-depends: debconf (>= 0.2.17), ${misc:Pre-Depends}
Multi-Arch: foreign
Depends: mysql-common, ${shlibs:Depends}, ${misc:Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Percona Server database common files (e.g. /etc/mysql/my.cnf)
Percona Server is a fast, stable and true multi-user, multi-threaded SQL
database server. SQL (Structured Query Language) is the most popular database
Expand Down
11 changes: 11 additions & 0 deletions build-ps/debian/extra/percona-server.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# The Percona Server 5.7 configuration file.
#
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
# Please make any edits and changes to the appropriate sectional files
# included below.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/percona-server.conf.d/
32 changes: 32 additions & 0 deletions build-ps/debian/extra/percona-server.conf.d/mysqld.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# The Percona Server 5.7 configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

log-error = /var/log/mysql/error.log

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
14 changes: 14 additions & 0 deletions build-ps/debian/extra/percona-server.conf.d/mysqld_safe.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# The Percona Server 5.7 configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0
3 changes: 3 additions & 0 deletions build-ps/debian/percona-server-common-5.7.install
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ usr/share/mysql/errmsg-utf8.txt
# charsets
usr/share/mysql/charsets/*.xml
usr/share/mysql/charsets/README
# config files
debian/extra/percona-server.cnf etc/mysql/
debian/extra/percona-server.conf.d etc/mysql/
40 changes: 40 additions & 0 deletions build-ps/debian/percona-server-common-5.7.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh

set -e

case "$1" in
configure)
# New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
# variants in Ubuntu. If the new mysql-common package does not provide
# the update-alternatives facility, fall back to creating a symlink
# if [ -f /usr/share/mysql-common/configure-symlinks ]
# then
# /usr/share/mysql-common/configure-symlinks install percona-server "/etc/mysql/percona-server.cnf"
# else
# echo "Notice: configure-symlinks trigger could not be called."
# echo "Please manually make /etc/mysql/my.cnf a symlink that points to percona-server.cnf."
# fi
if [ ! -f /etc/mysql/my.cnf ]
then
update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/percona-server.cnf" 200
else
echo " -------------"
echo " * The suggested mysql options and settings are in /etc/mysql/percona-server.conf.d/mysqld.cnf"
echo " * If you want to use mysqld.cnf as default configuration file please make backup of /etc/my.cnf"
echo " * Once it is done please execute the following commands:"
echo " rm -rf /etc/my.cnf"
echo " update-alternatives --install /etc/mysql/my.cnf my.cnf \"/etc/mysql/percona-server.cnf\" 200"
echo " -------------"
fi
;;

abort-upgrade|abort-remove|abort-configure)
;;

*)
echo "postinst called with unknown argument '$1'" 1>&2
exit 1
;;
esac

#DEBHELPER#
39 changes: 27 additions & 12 deletions build-ps/percona-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,14 @@ make DESTDIR=%{buildroot} install

# Install logrotate and autostart
install -D -m 0644 $MBD/release/support-files/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/mysql
%if 0%{?rhel} > 6
install -D -m 0644 $MBD/%{src_dir}/build-ps/rpm/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
%endif
install -d %{buildroot}%{_sysconfdir}/percona-server.conf.d
install -D -m 0644 $MBD/%{src_dir}/build-ps/rpm/percona-server.cnf %{buildroot}%{_sysconfdir}/percona-server.cnf
install -D -m 0644 $MBD/%{src_dir}/build-ps/rpm/mysqld.cnf %{buildroot}%{_sysconfdir}/percona-server.conf.d/mysqld.cnf
install -D -m 0644 $MBD/%{src_dir}/build-ps/rpm/mysqld_safe.cnf %{buildroot}%{_sysconfdir}/percona-server.conf.d/mysqld_safe.cnf

#%if 0%{?rhel} > 6
#install -D -m 0644 $MBD/%{src_dir}/build-ps/rpm/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
#%endif
install -d %{buildroot}%{_sysconfdir}/my.cnf.d
%if 0%{?systemd}
%else
Expand Down Expand Up @@ -495,10 +500,17 @@ datadir=$(/usr/bin/my_print_defaults server mysqld | grep '^--datadir=' | sed -n
%else
/sbin/chkconfig --add mysql
%endif
# We need this because we don't provide my.cnf on centos 6
# and the default system one doesn't have info needed
%if 0%{?rhel} < 7
if [ $1 -eq 1 ]; then
if [ ! -f /etc/my.cnf ]
then
update-alternatives --install /etc/my.cnf my.cnf "/etc/percona-server.cnf" 200
else
echo " -------------"
echo " * The suggested mysql options and settings are in /etc/percona-server.conf.d/mysqld.cnf"
echo " * If you want to use mysqld.cnf as default configuration file please make backup of /etc/my.cnf"
echo " * Once it is done please execute the following commands:"
echo " rm -rf /etc/my.cnf"
echo " update-alternatives --install /etc/my.cnf my.cnf \"/etc/percona-server.cnf\" 200"
echo " -------------"
cnflog=$(/usr/bin/my_print_defaults mysqld|grep -c log-error)
if [ $cnflog = 0 -a -f /etc/my.cnf ]; then
sed -i "/^\[mysqld\]$/a log-error=/var/log/mysqld.log" /etc/my.cnf
Expand All @@ -508,8 +520,6 @@ if [ $1 -eq 1 ]; then
sed -i "/^\[mysqld\]$/a pid-file=/var/run/mysqld/mysqld.pid" /etc/my.cnf
fi
fi
%endif

echo "Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit."
echo "Run the following commands to create these functions:"
echo "mysql -e \"CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'\""
Expand Down Expand Up @@ -600,10 +610,12 @@ fi
%attr(644, root, root) %{_mandir}/man1/lz4_decompress.1*
%attr(644, root, root) %{_mandir}/man1/zlib_decompress.1*

%if 0%{?rhel} > 6
%config(noreplace) %{_sysconfdir}/my.cnf
%dir %{_sysconfdir}/my.cnf.d
%endif
%dir %{_sysconfdir}/percona-server.conf.d
%config(noreplace) %{_sysconfdir}/percona-server.cnf
%config(noreplace) %{_sysconfdir}/percona-server.conf.d/mysqld.cnf
%config(noreplace) %{_sysconfdir}/percona-server.conf.d/mysqld_safe.cnf


%attr(755, root, root) %{_bindir}/innochecksum
%attr(755, root, root) %{_bindir}/my_print_defaults
Expand Down Expand Up @@ -902,6 +914,9 @@ fi
* Thu Sep 1 2016 Evgeniy Patlan <evgeniy.patlan@percona.com>
- fix license field

* Thu Aug 25 2016 Evgeniy Patlan <evgeniy.patlan@percona.com>
- Provide my.cnf for all systems

* Wed Mar 09 2016 Tomislav Plavcic <tomislav.plavcic@percona.com> - 5.7.11-4
- Include mysql-keyring directory
- Provide keyring_file.so plugin
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions build-ps/rpm/mysqld_safe.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# The Percona Server 5.7 configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0
11 changes: 11 additions & 0 deletions build-ps/rpm/percona-server.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# The Percona Server 5.7 configuration file.
#
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
# Please make any edits and changes to the appropriate sectional files
# included below.
#
!includedir /etc/my.cnf.d/
!includedir /etc/percona-server.conf.d/
2 changes: 1 addition & 1 deletion build-ps/ubuntu/control
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Section: database
Architecture: any
Pre-depends: debconf (>= 0.2.17), ${misc:Pre-Depends}
Multi-Arch: foreign
Depends: mysql-common, ${shlibs:Depends}, ${misc:Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Percona Server database common files (e.g. /etc/mysql/my.cnf)
Percona Server is a fast, stable and true multi-user, multi-threaded SQL
database server. SQL (Structured Query Language) is the most popular database
Expand Down
2 changes: 1 addition & 1 deletion build-ps/ubuntu/extra/percona-server.conf.d/mysqld.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bind-address = 127.0.0.1
log-error = /var/log/mysql/error.log

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
22 changes: 17 additions & 5 deletions build-ps/ubuntu/percona-server-common-5.7.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ case "$1" in
# New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
# variants in Ubuntu. If the new mysql-common package does not provide
# the update-alternatives facility, fall back to creating a symlink
if [ -f /usr/share/mysql-common/configure-symlinks ]
# if [ -f /usr/share/mysql-common/configure-symlinks ]
# then
# /usr/share/mysql-common/configure-symlinks install percona-server "/etc/mysql/percona-server.cnf"
# else
# echo "Notice: configure-symlinks trigger could not be called."
# echo "Please manually make /etc/mysql/my.cnf a symlink that points to percona-server.cnf."
# fi
if [ ! -f /etc/mysql/my.cnf ]
then
/usr/share/mysql-common/configure-symlinks install percona-server "/etc/mysql/percona-server.cnf"
update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/percona-server.cnf" 200
else
echo "Notice: configure-symlinks trigger could not be called."
echo "Please manually make /etc/mysql/my.cnf a symlink that points to percona-server.cnf."
fi
echo " -------------"
echo " * The suggested mysql options and settings are in /etc/mysql/percona-server.conf.d/mysqld.cnf"
echo " * If you want to use mysqld.cnf as default configuration file please make backup of /etc/my.cnf"
echo " * Once it is done please execute the following commands:"
echo " rm -rf /etc/my.cnf"
echo " update-alternatives --install /etc/mysql/my.cnf my.cnf \"/etc/mysql/percona-server.cnf\" 200"
echo " -------------"
fi
;;

abort-upgrade|abort-remove|abort-configure)
Expand Down
2 changes: 2 additions & 0 deletions scripts/ps_tokudb_admin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ if [ $FULL_SYSTEMD_MODE = 0 ]; then
if [ -z $MYCNF_LOCATION ]; then
if [ -f /etc/mysql/percona-server.conf.d/mysqld_safe.cnf ]; then
MYCNF_LOCATION=/etc/mysql/percona-server.conf.d/mysqld_safe.cnf
elif [ -f /etc/percona-server.conf.d/mysqld_safe.cnf ]; then
MYCNF_LOCATION=/etc/percona-server.conf.d/mysqld_safe.cnf
elif [ -f /etc/my.cnf ]; then
MYCNF_LOCATION=/etc/my.cnf
elif [ -f /etc/mysql/my.cnf ]; then
Expand Down

0 comments on commit 05a0358

Please sign in to comment.