Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Dean Troyer | 6d04fd7 | 2012-12-21 11:03:37 -0600 | [diff] [blame] | 3 | # lib/databases/mysql |
| 4 | # Functions to control the configuration and operation of the **MySQL** database backend |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 5 | |
| 6 | # Dependencies: |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 7 | # |
| 8 | # - DATABASE_{HOST,USER,PASSWORD} must be defined |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 9 | |
| 10 | # Save trace setting |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 11 | _XTRACE_DB_MYSQL=$(set +o | grep xtrace) |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 12 | set +o xtrace |
| 13 | |
armando-migliaccio | b3d8822 | 2015-06-12 07:54:03 -0700 | [diff] [blame] | 14 | MYSQL_DRIVER=${MYSQL_DRIVER:-PyMySQL} |
Carlos Camacho | cc6e20b | 2022-01-07 15:30:56 +0100 | [diff] [blame] | 15 | INSTALL_DATABASE_SERVER_PACKAGES=$(trueorfalse True INSTALL_DATABASE_SERVER_PACKAGES) |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 16 | |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 17 | register_database mysql |
| 18 | |
Slawek Kaplonski | d54a1c6 | 2019-09-10 12:05:06 +0200 | [diff] [blame] | 19 | if [[ -z "$MYSQL_SERVICE_NAME" ]]; then |
| 20 | MYSQL_SERVICE_NAME=mysql |
| 21 | if is_fedora && ! is_oraclelinux; then |
| 22 | MYSQL_SERVICE_NAME=mariadb |
Dr. Jens Harbott | 0b79f6f | 2023-07-04 07:18:01 +0200 | [diff] [blame] | 23 | elif [[ "$DISTRO" =~ bookworm|bullseye ]]; then |
Jens Harbott | 959a7c2 | 2021-05-02 09:29:15 +0200 | [diff] [blame] | 24 | MYSQL_SERVICE_NAME=mariadb |
Slawek Kaplonski | d54a1c6 | 2019-09-10 12:05:06 +0200 | [diff] [blame] | 25 | fi |
Sean Dague | 5375329 | 2014-12-04 19:38:15 -0500 | [diff] [blame] | 26 | fi |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 27 | |
| 28 | # Functions |
| 29 | # --------- |
| 30 | |
Julien Danjou | 0eec4f8 | 2015-09-08 10:45:06 +0000 | [diff] [blame] | 31 | function get_database_type_mysql { |
| 32 | if [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then |
| 33 | echo mysql+pymysql |
| 34 | else |
| 35 | echo mysql |
| 36 | fi |
| 37 | } |
| 38 | |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 39 | # Get rid of everything enough to cleanly change database backends |
| 40 | function cleanup_database_mysql { |
Dirk Mueller | 1d968d7 | 2017-09-23 14:45:42 +0200 | [diff] [blame] | 41 | stop_service $MYSQL_SERVICE_NAME |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 42 | if is_ubuntu; then |
| 43 | # Get ruthless with mysql |
Sean Dague | 8f90f76 | 2015-01-14 10:36:48 -0500 | [diff] [blame] | 44 | apt_get purge -y mysql* mariadb* |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 45 | sudo rm -rf /var/lib/mysql |
Tiago Mello | 4376ae0 | 2014-03-14 10:48:56 -0300 | [diff] [blame] | 46 | sudo rm -rf /etc/mysql |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 47 | return |
Dirk Mueller | 1d968d7 | 2017-09-23 14:45:42 +0200 | [diff] [blame] | 48 | elif is_oraclelinux; then |
Wiekus Beukes | ec47bc1 | 2015-03-19 08:20:38 -0700 | [diff] [blame] | 49 | uninstall_package mysql-community-server |
| 50 | sudo rm -rf /var/lib/mysql |
Martin Kopec | ec07b34 | 2023-01-24 17:38:45 +0100 | [diff] [blame] | 51 | elif is_fedora; then |
Attila Fazekas | 1f316be | 2015-01-26 16:39:57 +0100 | [diff] [blame] | 52 | uninstall_package mariadb-server |
| 53 | sudo rm -rf /var/lib/mysql |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 54 | else |
| 55 | return |
| 56 | fi |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 57 | } |
| 58 | |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 59 | function recreate_database_mysql { |
| 60 | local db=$1 |
zhhuabj | 2832f28 | 2013-05-08 18:43:26 +0800 | [diff] [blame] | 61 | mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "DROP DATABASE IF EXISTS $db;" |
Ihar Hrachyshka | 157c84b | 2014-10-06 13:29:39 +0200 | [diff] [blame] | 62 | mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "CREATE DATABASE $db CHARACTER SET utf8;" |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | function configure_database_mysql { |
Ade Lee | 15b2e42 | 2023-01-24 14:44:13 +0100 | [diff] [blame] | 66 | local my_conf mysql slow_log my_client_conf |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 67 | echo_summary "Configuring and starting MySQL" |
| 68 | |
Vincent Untz | c18b965 | 2012-12-04 12:36:34 +0100 | [diff] [blame] | 69 | if is_ubuntu; then |
Dean Troyer | 3ef23bc | 2014-07-25 14:56:22 -0500 | [diff] [blame] | 70 | my_conf=/etc/mysql/my.cnf |
Martin Kopec | ec07b34 | 2023-01-24 17:38:45 +0100 | [diff] [blame] | 71 | elif is_oraclelinux; then |
Wiekus Beukes | ec47bc1 | 2015-03-19 08:20:38 -0700 | [diff] [blame] | 72 | my_conf=/etc/my.cnf |
Vincent Untz | 00011c0 | 2012-12-06 09:56:32 +0100 | [diff] [blame] | 73 | elif is_fedora; then |
Dean Troyer | 3ef23bc | 2014-07-25 14:56:22 -0500 | [diff] [blame] | 74 | my_conf=/etc/my.cnf |
Yuval Brik | 13e81ad | 2017-06-23 10:32:16 +0300 | [diff] [blame] | 75 | local cracklib_conf=/etc/my.cnf.d/cracklib_password_check.cnf |
| 76 | if [ -f "$cracklib_conf" ]; then |
| 77 | inicomment -sudo "$cracklib_conf" "mariadb" "plugin-load-add" |
| 78 | fi |
Vincent Untz | 00011c0 | 2012-12-06 09:56:32 +0100 | [diff] [blame] | 79 | else |
| 80 | exit_distro_not_supported "mysql configuration" |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 81 | fi |
| 82 | |
Ade Lee | 15b2e42 | 2023-01-24 14:44:13 +0100 | [diff] [blame] | 83 | # Set fips mode on |
| 84 | if is_ubuntu; then |
| 85 | if is_fips_enabled; then |
| 86 | my_client_conf=/etc/mysql/mysql.conf.d/mysql.cnf |
| 87 | iniset -sudo $my_client_conf mysql ssl-fips-mode "on" |
| 88 | iniset -sudo $my_conf mysqld ssl-fips-mode "on" |
| 89 | fi |
| 90 | fi |
| 91 | |
Brian Haley | 7943a92 | 2022-03-14 13:53:41 -0400 | [diff] [blame] | 92 | # Change bind-address from localhost (127.0.0.1) to any (::) |
| 93 | iniset -sudo $my_conf mysqld bind-address "$(ipv6_unquote $SERVICE_LISTEN_ADDRESS)" |
| 94 | |
| 95 | # (Re)Start mysql-server |
Martin Kopec | ec07b34 | 2023-01-24 17:38:45 +0100 | [diff] [blame] | 96 | if is_fedora; then |
Vincent Untz | 00011c0 | 2012-12-06 09:56:32 +0100 | [diff] [blame] | 97 | # service is not started by default |
Dirk Mueller | 1d968d7 | 2017-09-23 14:45:42 +0200 | [diff] [blame] | 98 | start_service $MYSQL_SERVICE_NAME |
Brian Haley | 7943a92 | 2022-03-14 13:53:41 -0400 | [diff] [blame] | 99 | elif is_ubuntu; then |
| 100 | # required since bind-address could have changed above |
| 101 | restart_service $MYSQL_SERVICE_NAME |
Vincent Untz | 00011c0 | 2012-12-06 09:56:32 +0100 | [diff] [blame] | 102 | fi |
| 103 | |
| 104 | # Set the root password - only works the first time. For Ubuntu, we already |
Jens Rosenboom | 9abb26d | 2016-12-07 21:12:55 +0100 | [diff] [blame] | 105 | # did that with debconf before installing the package, but we still try, |
Miguel Lavalle | 0a40648 | 2022-12-07 16:51:28 -0600 | [diff] [blame] | 106 | # because the package might have been installed already. We don't do this |
yatinkarel | 97ea68e | 2024-12-02 17:46:42 +0530 | [diff] [blame] | 107 | # for Ubuntu 22.04+ because the authorization model change in |
Miguel Lavalle | 0a40648 | 2022-12-07 16:51:28 -0600 | [diff] [blame] | 108 | # version 10.4 of mariadb. See |
| 109 | # https://mariadb.org/authentication-in-mariadb-10-4/ |
yatinkarel | 97ea68e | 2024-12-02 17:46:42 +0530 | [diff] [blame] | 110 | if ! (is_ubuntu && [[ ! "$DISTRO" =~ bookworm|bullseye ]] && [ "$MYSQL_SERVICE_NAME" == "mariadb" ]); then |
Miguel Lavalle | 0a40648 | 2022-12-07 16:51:28 -0600 | [diff] [blame] | 111 | sudo mysqladmin -u root password $DATABASE_PASSWORD || true |
| 112 | fi |
Vincent Untz | 00011c0 | 2012-12-06 09:56:32 +0100 | [diff] [blame] | 113 | |
Slawek Kaplonski | d54a1c6 | 2019-09-10 12:05:06 +0200 | [diff] [blame] | 114 | # In case of Mariadb, giving hostname in arguments causes permission |
| 115 | # problems as it expects connection through socket |
| 116 | if is_ubuntu && [ "$MYSQL_SERVICE_NAME" == "mariadb" ]; then |
| 117 | local cmd_args="-uroot -p$DATABASE_PASSWORD " |
| 118 | else |
Brian Haley | 7943a92 | 2022-03-14 13:53:41 -0400 | [diff] [blame] | 119 | local cmd_args="-uroot -p$DATABASE_PASSWORD -h$SERVICE_LOCAL_HOST " |
Slawek Kaplonski | d54a1c6 | 2019-09-10 12:05:06 +0200 | [diff] [blame] | 120 | fi |
| 121 | |
| 122 | # In mariadb e.g. on Ubuntu socket plugin is used for authentication |
| 123 | # as root so it works only as sudo. To restore old "mysql like" behaviour, |
| 124 | # we need to change auth plugin for root user |
Dr. Jens Harbott | 0b79f6f | 2023-07-04 07:18:01 +0200 | [diff] [blame] | 125 | # TODO(frickler): simplify this logic |
| 126 | if is_ubuntu && [[ ! "$DISTRO" =~ bookworm|bullseye ]] && [ "$MYSQL_SERVICE_NAME" == "mariadb" ]; then |
yatinkarel | 97ea68e | 2024-12-02 17:46:42 +0530 | [diff] [blame] | 127 | # For Ubuntu 22.04+ we follow the model outlined in |
| 128 | # https://mariadb.org/authentication-in-mariadb-10-4/ |
| 129 | sudo mysql -e "ALTER USER $DATABASE_USER@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('$DATABASE_PASSWORD');" |
Slawek Kaplonski | d54a1c6 | 2019-09-10 12:05:06 +0200 | [diff] [blame] | 130 | fi |
yatinkarel | 97ea68e | 2024-12-02 17:46:42 +0530 | [diff] [blame] | 131 | if ! (is_ubuntu && [[ ! "$DISTRO" =~ bookworm|bullseye ]] && [ "$MYSQL_SERVICE_NAME" == "mariadb" ]); then |
Miguel Lavalle | 0a40648 | 2022-12-07 16:51:28 -0600 | [diff] [blame] | 132 | # Create DB user if it does not already exist |
| 133 | sudo mysql $cmd_args -e "CREATE USER IF NOT EXISTS '$DATABASE_USER'@'%' identified by '$DATABASE_PASSWORD';" |
| 134 | # Update the DB to give user '$DATABASE_USER'@'%' full control of the all databases: |
| 135 | sudo mysql $cmd_args -e "GRANT ALL PRIVILEGES ON *.* TO '$DATABASE_USER'@'%';" |
| 136 | fi |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 137 | |
| 138 | # Now update ``my.cnf`` for some local needs and restart the mysql service |
| 139 | |
Brian Haley | 7943a92 | 2022-03-14 13:53:41 -0400 | [diff] [blame] | 140 | # Set default db type to InnoDB |
Roman Podoliaka | 88b8409 | 2017-02-07 13:34:12 +0200 | [diff] [blame] | 141 | iniset -sudo $my_conf mysqld sql_mode TRADITIONAL |
Ian Wienand | 9c0b9f3 | 2015-07-22 06:08:09 +1000 | [diff] [blame] | 142 | iniset -sudo $my_conf mysqld default-storage-engine InnoDB |
Jens Rosenboom | 4b59fbb | 2017-03-15 21:58:48 +0000 | [diff] [blame] | 143 | iniset -sudo $my_conf mysqld max_connections 1024 |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 144 | |
Jeremy Stanley | c4f4734 | 2014-01-25 01:10:31 +0000 | [diff] [blame] | 145 | if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then |
| 146 | echo_summary "Enabling MySQL query logging" |
Attila Fazekas | 1f316be | 2015-01-26 16:39:57 +0100 | [diff] [blame] | 147 | if is_fedora; then |
Attila Fazekas | 3b53aeb | 2014-04-30 11:57:22 +0200 | [diff] [blame] | 148 | slow_log=/var/log/mariadb/mariadb-slow.log |
| 149 | else |
| 150 | slow_log=/var/log/mysql/mysql-slow.log |
| 151 | fi |
Ralf Haferkamp | 0526bb8 | 2014-04-03 08:27:33 +0200 | [diff] [blame] | 152 | sudo sed -e '/log.slow.queries/d' \ |
| 153 | -e '/long.query.time/d' \ |
| 154 | -e '/log.queries.not.using.indexes/d' \ |
Dean Troyer | 3ef23bc | 2014-07-25 14:56:22 -0500 | [diff] [blame] | 155 | -i $my_conf |
Monty Taylor | 7c73e8d | 2013-01-07 08:17:01 +0000 | [diff] [blame] | 156 | |
Ralf Haferkamp | 0526bb8 | 2014-04-03 08:27:33 +0200 | [diff] [blame] | 157 | # Turn on slow query log, log all queries (any query taking longer than |
| 158 | # 0 seconds) and log all non-indexed queries |
Ian Wienand | 9c0b9f3 | 2015-07-22 06:08:09 +1000 | [diff] [blame] | 159 | iniset -sudo $my_conf mysqld slow-query-log 1 |
| 160 | iniset -sudo $my_conf mysqld slow-query-log-file $slow_log |
| 161 | iniset -sudo $my_conf mysqld long-query-time 0 |
| 162 | iniset -sudo $my_conf mysqld log-queries-not-using-indexes 1 |
Jeremy Stanley | c4f4734 | 2014-01-25 01:10:31 +0000 | [diff] [blame] | 163 | fi |
Monty Taylor | 7c73e8d | 2013-01-07 08:17:01 +0000 | [diff] [blame] | 164 | |
Dan Smith | c2772c2 | 2022-04-08 08:48:49 -0700 | [diff] [blame] | 165 | if [[ "$MYSQL_GATHER_PERFORMANCE" == "True" ]]; then |
Dan Smith | fe52d7f | 2022-04-28 12:34:38 -0700 | [diff] [blame] | 166 | echo "enabling MySQL performance counting" |
| 167 | |
| 168 | # Install our sqlalchemy plugin |
| 169 | pip_install ${TOP_DIR}/tools/dbcounter |
| 170 | |
| 171 | # Create our stats database for accounting |
| 172 | recreate_database stats |
| 173 | mysql -u $DATABASE_USER -p$DATABASE_PASSWORD -h $MYSQL_HOST -e \ |
| 174 | "CREATE TABLE queries (db VARCHAR(32), op VARCHAR(32), |
| 175 | count INT, PRIMARY KEY (db, op)) ENGINE MEMORY" stats |
Dan Smith | c2772c2 | 2022-04-08 08:48:49 -0700 | [diff] [blame] | 176 | fi |
| 177 | |
Dan Smith | 7567359 | 2023-02-13 14:41:40 +0000 | [diff] [blame] | 178 | if [[ "$MYSQL_REDUCE_MEMORY" == "True" ]]; then |
| 179 | iniset -sudo $my_conf mysqld read_buffer_size 64K |
| 180 | iniset -sudo $my_conf mysqld innodb_buffer_pool_size 16M |
| 181 | iniset -sudo $my_conf mysqld thread_stack 192K |
| 182 | iniset -sudo $my_conf mysqld thread_cache_size 8 |
| 183 | iniset -sudo $my_conf mysqld tmp_table_size 8M |
| 184 | iniset -sudo $my_conf mysqld sort_buffer_size 8M |
| 185 | iniset -sudo $my_conf mysqld max_allowed_packet 8M |
| 186 | fi |
| 187 | |
Dirk Mueller | 1d968d7 | 2017-09-23 14:45:42 +0200 | [diff] [blame] | 188 | restart_service $MYSQL_SERVICE_NAME |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | function install_database_mysql { |
Vincent Untz | c18b965 | 2012-12-04 12:36:34 +0100 | [diff] [blame] | 192 | if is_ubuntu; then |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 193 | # Seed configuration with mysql password so that apt-get install doesn't |
| 194 | # prompt us for a password upon install. |
Bob Ball | 9033343 | 2015-01-19 10:56:42 +0000 | [diff] [blame] | 195 | sudo debconf-set-selections <<MYSQL_PRESEED |
| 196 | mysql-server mysql-server/root_password password $DATABASE_PASSWORD |
| 197 | mysql-server mysql-server/root_password_again password $DATABASE_PASSWORD |
| 198 | mysql-server mysql-server/start_on_boot boolean true |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 199 | MYSQL_PRESEED |
| 200 | fi |
| 201 | |
| 202 | # while ``.my.cnf`` is not needed for OpenStack to function, it is useful |
| 203 | # as it allows you to access the mysql databases via ``mysql nova`` instead |
| 204 | # of having to specify the username/password each time. |
| 205 | if [[ ! -e $HOME/.my.cnf ]]; then |
| 206 | cat <<EOF >$HOME/.my.cnf |
| 207 | [client] |
| 208 | user=$DATABASE_USER |
| 209 | password=$DATABASE_PASSWORD |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 210 | EOF |
Slawek Kaplonski | d54a1c6 | 2019-09-10 12:05:06 +0200 | [diff] [blame] | 211 | |
| 212 | if ! is_ubuntu || [ "$MYSQL_SERVICE_NAME" != "mariadb" ]; then |
| 213 | echo "host=$MYSQL_HOST" >> $HOME/.my.cnf |
| 214 | fi |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 215 | chmod 0600 $HOME/.my.cnf |
| 216 | fi |
| 217 | # Install mysql-server |
Carlos Camacho | cc6e20b | 2022-01-07 15:30:56 +0100 | [diff] [blame] | 218 | if [[ "$INSTALL_DATABASE_SERVER_PACKAGES" == "True" ]]; then |
| 219 | if is_oraclelinux; then |
| 220 | install_package mysql-community-server |
| 221 | elif is_fedora; then |
| 222 | install_package mariadb-server mariadb-devel mariadb |
| 223 | sudo systemctl enable $MYSQL_SERVICE_NAME |
Carlos Camacho | cc6e20b | 2022-01-07 15:30:56 +0100 | [diff] [blame] | 224 | elif is_ubuntu; then |
| 225 | install_package $MYSQL_SERVICE_NAME-server |
| 226 | else |
| 227 | exit_distro_not_supported "mysql installation" |
| 228 | fi |
Vincent Untz | ca5c471 | 2012-11-21 17:45:49 +0100 | [diff] [blame] | 229 | fi |
Dean Troyer | 5686dbc | 2015-03-09 14:27:51 -0500 | [diff] [blame] | 230 | } |
Dean Troyer | b1d8e8e | 2015-02-16 13:58:35 -0600 | [diff] [blame] | 231 | |
Dean Troyer | 5686dbc | 2015-03-09 14:27:51 -0500 | [diff] [blame] | 232 | function install_database_python_mysql { |
Dean Troyer | b1d8e8e | 2015-02-16 13:58:35 -0600 | [diff] [blame] | 233 | # Install Python client module |
Sean Dague | 3742199 | 2015-05-20 06:37:11 -0700 | [diff] [blame] | 234 | pip_install_gr $MYSQL_DRIVER |
| 235 | if [[ "$MYSQL_DRIVER" == "MySQL-python" ]]; then |
| 236 | ADDITIONAL_VENV_PACKAGES+=",MySQL-python" |
Julien Danjou | 0f63eb3 | 2015-06-12 09:05:12 +0200 | [diff] [blame] | 237 | elif [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then |
| 238 | ADDITIONAL_VENV_PACKAGES+=",PyMySQL" |
Sean Dague | 3742199 | 2015-05-20 06:37:11 -0700 | [diff] [blame] | 239 | fi |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | function database_connection_url_mysql { |
Attila Fazekas | 7e79d91 | 2013-03-03 12:23:04 +0100 | [diff] [blame] | 243 | local db=$1 |
Dan Smith | fe52d7f | 2022-04-28 12:34:38 -0700 | [diff] [blame] | 244 | local plugin |
| 245 | |
| 246 | # NOTE(danms): We don't enable perf on subnodes yet because the |
| 247 | # plugin is not installed there |
| 248 | if [[ "$MYSQL_GATHER_PERFORMANCE" == "True" ]]; then |
| 249 | if is_service_enabled mysql; then |
| 250 | plugin="&plugin=dbcounter" |
| 251 | fi |
| 252 | fi |
| 253 | |
| 254 | echo "$BASE_SQL_CONN/$db?charset=utf8$plugin" |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 255 | } |
| 256 | |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 257 | |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 258 | # Restore xtrace |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 259 | $_XTRACE_DB_MYSQL |
Sean Dague | 584d90e | 2013-03-29 14:34:53 -0400 | [diff] [blame] | 260 | |
| 261 | # Local variables: |
| 262 | # mode: shell-script |
| 263 | # End: |