Sometimes, for various reasons (Redundancy, organisational policies, etc.), it might be necessary to use an externally managed database. This use case can be achieved by simply taking some extra steps:
In order to enable external mariadb support,
you will first need to disable mariadb deployment,
by ensuring the following line exists within /etc/kolla/globals.yml
:
enable_mariadb: "no"
There are two ways in which you can use external MariaDB:
If your external database already has a load balancer, you will need to do the following:
Change the following
[mariadb:children]
control
so that it looks like below:
[mariadb]
myexternalmariadbloadbalancer.com
/etc/kolla/globals.yml
database_address: myexternalloadbalancer.com
Please note that if enable_external_mariadb_load_balancer is set to “no” - default, the external DB load balancer will need to be accessible from all nodes within your deployment, which might connect to it.
Then, you will need to adjust your inventory file:
Change the following
[mariadb:children]
control
so that it looks like below:
[mariadb]
myexternaldbserver1.com
myexternaldbserver2.com
myexternaldbserver3.com
If you choose to use haproxy for load balancing between the members of the cluster, every node within this group needs to be resolvable and reachable and resolvable from all the hosts within the [haproxy:children] group of your inventory (defaults to [network]).
In addition to that, you also need to set the following within
/etc/kolla/globals.yml
:
enable_external_mariadb_load_balancer: yes
In case your MariaDB user is root, just leave
everything as it is within globals.yml (Except the
internal mariadb deployment, which should be disabled),
and set the database_password field within
/etc/kolla/passwords.yml
database_password: mySuperSecurePassword
In case your username is other than root, you will
need to also set it, within /etc/kolla/globals.yml
database_username: "privillegeduser"
The first step you need to take is the following:
Within /etc/kolla/globals.yml
, set the following:
use_preconfigured_databases: "yes"
Note
Please note that when the use_preconfigured_databases
flag
is set to "yes"
, you need to have the log_bin_trust_function_creators
mysql variable set to 1
by your database administrator before running the
upgrade
command.
In order to achieve this, you will need to define the user names within
/etc/kolla/globals.yml
, as illustrated by the example below:
keystone_database_user: preconfigureduser1
nova_database_user: preconfigureduser2
You will need to also set the passwords for all databases within
/etc/kolla/passwords.yml
However, fortunately, using a common user across all databases is also possible.
In order to use a common, preconfigured user across all databases, all you need to do is the following:
/etc/kolla/globals.yml
, add the following:use_common_mariadb_user: "yes"
/etc/kolla/globals.yml
to
the one provided to you:database_user: mycommondatabaseuser
/etc/kolla/passwords.yml`
.
In order to achieve that you could use the following command:sed -i -r -e 's/([a-z_]{0,}database_password:+)(.*)$/\1 mycommonpass/gi' /etc/kolla/passwords.yml
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.