Commit 02590249 authored by benedikt.kroening's avatar benedikt.kroening
Browse files

install-database scripts now supports mysql and mariadb

Configurable via config/config (type and version)
parent 6019512a
.runtime
.DS_Store
*.key
mariadb_repo_setup.sh
mariadb_repo_setup
......@@ -21,6 +21,11 @@ You may also override config by providing environmental variables.
Versions can be configured at `setup/versions`
Check that file for more information.
### Database versions
By modifying the DATABASE_TYPE and DATBASE_VERSION variables (`config/config`) you can manually specify which database type and version to use.
Currently supported are mysql and mariadb in all versions as listed on the support matrix
## Good to know
This script collection has its roots in the old ox-quickinstall (or installer). Much of the install logic for the different distros was simply taken from there and still can be found at `lib/common.bash`
......
See https://oxpedia.org/wiki/index.php?title=My.cnf
The present ox-tunings.cnf uses lower lower buffer pool sizes for test setups
\ No newline at end of file
[mysqld]
bind-address = *
#innodb_use_native_aio = 0
table_open_cache = 3072
table_definition_cache = 4096
max_heap_table_size = 64M
tmp_table_size = 64M
max_connections = 505
max_user_connections = 500
max_allowed_packet = 16M
thread_cache_size = 32
query_cache_size = 0
query_cache_type = 0
innodb_buffer_pool_size = 1G
# the default value in MySQL 5.6.6 and higher is 8 when innodb_buffer_pool_size is greater than or equal to 1GB. Otherwise, the default is 1.
innodb_buffer_pool_instances = 8
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_per_table = 1
# innodb_log_file_size should be 25% of the innodb_buffer_pool_size
innodb_log_file_size = 4GB
# default and recommended value is 2
innodb_log_files_in_group = 2
# adjust according to your storage
#innodb_io_capacity = 1000
# we are unsure about this setting. Newer versions of MariaDB seem to be fine with low (=1) settings for this value.
# Traditionally we encountered values up to 4x the number of cores.
# Default seems to be number of cores, so let's stick the default
# In the end, we need to leave this setting up to you: if you dont get full cpu utilization in cpu-bound situations, this might be a setting to increase.
#thread_pool_size = 32
binlog_cache_size = 1M
sync_binlog = 8
binlog_format = row
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
# This was default_table_type previous to MySQL 5.5
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
# keep until 5.6, deprecated later
innodb_locks_unsafe_for_binlog = 1
# we found this has huge impact on (galera) performance
# default (consistent) setting of 1 greatly severs performance
# in galera (or async master-slave) deployments, you might be ok with setting this to 0 or 2,
# assuming our consistency / availability comes from replication / other cluster nodes
innodb_flush_log_at_trx_commit = 0
# for performance testing systems, to not use excessive disk space
#expire_logs_days = 1
# MySQL 5.7.7 has changed the default to 1. Disable it explicitly to prevent from errors based on invalid data stored by former App Suite or MySQL versions.
innodb_strict_mode = 0
# The following value refers to App Suite 7.10 on top of MySQL 5.7. For other combinations see the sql mode matrix at http://oxpedia.org/wiki/index.php?title=My.cnf.
sql_mode = NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,ONLY_FULL_GROUP_BY
......@@ -27,6 +27,7 @@ SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P)"
# sourcing some commonly used functions and executing basic checks
source ${SCRIPT_DIR}/../lib/common.bash
source ${SCRIPT_DIR}/../lib/setup.bash
DB_SERVICE_NAME=mysql
## Help text
......@@ -58,22 +59,22 @@ case $key in
shift
;;
--type)
DATABASE_TYPE=$s
export DATABASE_TYPE=$2
shift
shift
;;
--version)
DATABASE_VERSION=$2
export DATABASE_VERSION=$2
shift
shift
;;
--root-password)
DATABASE_ROOT_PASS="$2"
export DATABASE_ROOT_PASS="$2"
shift
shift
;;
--init)
OX_INIT=true;
export OX_INIT=true;
shift
;;
# --foo) # non value argument
......@@ -118,12 +119,11 @@ sleep 3
if [[ "${DATABASE_TYPE}" == "mysql" ]]; then
echo "Installing mysql-server packages..."
echo -n "Adding MySQL repositories"
echo "Adding MySQL repositories"
if [[ true == "${ANY_DEB}" ]]; then
DB_SERVICE_NAME=mysql
# Adding mysql key
# apt-key adv --recv-keys 5072E1F5
gpg --keyserver keys.gnupg.net --recv-key 5072E1F5
gpg --export -a 5072E1F5 > mysql-repo.key
apt-key add mysql-repo.key
......@@ -155,9 +155,58 @@ if [[ "${DATABASE_TYPE}" == "mysql" ]]; then
installPackages "mysql-server"
elif [[ "${DATABASE_TYPE}" == "mariadb" ]]; then
echo "Installing mariadb-server packages..."
echo "Using the setup script that is provided by mariadb..."
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup -O ${SCRIPT_DIR}/mariadb_repo_setup.sh
chmod +x ${SCRIPT_DIR}/mariadb_repo_setup.sh
if [[ true == "${ANY_DEB}" ]]; then
DB_SERVICE_NAME=mysql
# Adding mariadb key
gpg --keyserver keyserver.ubuntu.com --recv-key 0xF1656F24C74CD1D8
gpg --export -a 0xF1656F24C74CD1D8 > mariadb-repo.key
apt-key add mariadb-repo.key
# {
# echo "deb http://repo.mysql.com/apt/debian/ ${DIST_VERSION} mysql-$DATABASE_VERSION"
# echo "deb http://repo.mysql.com/apt/debian/ ${DIST_VERSION} mysql-tools"
# # echo "deb-src http://repo.mysql.com/apt/debian/ stretch mysql-$DATABASE_VERSION"
# } > /etc/apt/sources.list.d/mysql.list
elif [[ true == "${ANY_SLES}" ]]; then
echo ""
echo "ERROR: database setup on sles not yet implemented"
echo ""
sleep 10
exit 1
# mariadb should actually work - just not yet tested
elif [[ true == "${ANY_RHEL}" ]] || [[ true == "${ANY_CENTOS}" ]]; then
DB_SERVICE_NAME=mysqld
gpg --keyserver keys.gnupg.net --recv-key 5072E1F5
gpg --export -a 5072E1F5 > mysql-repo.key
rpm --import mysql-repo.key
# {
# echo "[mysql-repo]"
# echo "name=MySQL ${DATABASE_VERSION} Community Server"
# echo "baseurl=http://repo.mysql.com/yum/mysql-${DATABASE_VERSION}-community/el/${DIST_VERSION}/\$basearch/"
# echo "gpgcheck=1"
# } > /etc/yum.repos.d/mysql.repo
fi
echo "Executing prep script ${SCRIPT_DIR}/mariadb_repo_setup.sh ..."
sleep 5
${SCRIPT_DIR}/mariadb_repo_setup.sh --mariadb-server-version=mariadb-${DATABASE_VERSION}
installPackages mariadb-server
fi
if [[ "${OX_INIT}" == true ]]; then
cp ${SCRIPT_DIR}/../config/database/ox-tunings.cnf /etc/mysql/conf.d
restartService ${DB_SERVICE_NAME}
waitPort localhost 3306
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment