Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. .. _using-external-mariadb:
  2.  
  3. ================
  4. External MariaDB
  5. ================
  6.  
  7. Sometimes, for various reasons (Redundancy, organisational policies, etc.),
  8. it might be necessary to use an externally managed database.
  9. This use case can be achieved by simply taking some extra steps:
  10.  
  11. Requirements
  12. ============
  13.  
  14. * An existing MariaDB cluster / server, reachable from all of your
  15. nodes.
  16. * Existing users and databases, if you choose to use preconfigured
  17. databases and users (**use_preconfigured_databases** set to "yes").
  18. The existing databases will just be populated
  19. * If you do have root user access, you can leave the
  20. **use_preconfigured_databases** flag alone, and the databases will
  21. be both populated and created
  22.  
  23. Enabling External MariaDB support
  24. =================================
  25.  
  26. In order to enable external mariadb support,
  27. you will first need to disable mariadb deployment,
  28. by ensuring the following line exists within ``/etc/kolla/globals.yml`` :
  29.  
  30. .. code-block:: yaml
  31.  
  32. enable_mariadb: "no"
  33.  
  34. .. end
  35.  
  36. There are two ways in which you can use
  37. external MariaDB:
  38.  
  39. Using an already load-balanced MariaDB address (recommended)
  40. ------------------------------------------------------------
  41.  
  42. If your external database already has a
  43. load balancer, you will need to do the following:
  44.  
  45. * Within your inventory file, just add the hostname
  46. of the load balancer within the mariadb group,
  47. described as below:
  48.  
  49. Change the following
  50.  
  51. .. code-block:: ini
  52.  
  53. [mariadb:children]
  54. control
  55.  
  56. .. end
  57.  
  58. so that it looks like below:
  59.  
  60. .. code-block:: ini
  61.  
  62. [mariadb]
  63. myexternalmariadbloadbalancer.com
  64.  
  65. .. end
  66.  
  67. * Define **database_address** within ``/etc/kolla/globals.yml``
  68.  
  69. .. code-block:: yaml
  70.  
  71. database_address: myexternalloadbalancer.com
  72.  
  73. .. end
  74.  
  75. Please note that if **enable_external_mariadb_load_balancer** is
  76. set to "no" - **default**, the external DB load balancer will need to be
  77. accessible from all nodes within your deployment, which might
  78. connect to it.
  79.  
  80. 2. Using an external MariaDB cluster:
  81. -------------------------------------
  82.  
  83. Then, you will need to adjust your inventory file:
  84.  
  85. Change the following
  86.  
  87. .. code-block:: ini
  88.  
  89. [mariadb:children]
  90. control
  91.  
  92. .. end
  93.  
  94. so that it looks like below:
  95.  
  96. .. code-block:: ini
  97.  
  98. [mariadb]
  99. myexternaldbserver1.com
  100. myexternaldbserver2.com
  101. myexternaldbserver3.com
  102.  
  103. .. end
  104.  
  105. If you choose to use haproxy for load balancing between the
  106. members of the cluster, every node within this group
  107. needs to be resolvable and reachable and resolvable from all
  108. the hosts within the **[haproxy:children]** group
  109. of your inventory (defaults to **[network]**).
  110.  
  111. In addition to that, you also need to set the following within
  112. ``/etc/kolla/globals.yml``:
  113.  
  114. .. code-block:: yaml
  115.  
  116. enable_external_mariadb_load_balancer: yes
  117.  
  118. .. end
  119.  
  120. Using External MariaDB with a privileged user
  121. =============================================
  122.  
  123. In case your MariaDB user is root, just leave
  124. everything as it is within globals.yml (Except the
  125. internal mariadb deployment, which should be disabled),
  126. and set the **database_password** field within
  127. ``/etc/kolla/passwords.yml``
  128.  
  129. .. code-block:: yaml
  130.  
  131. database_password: mySuperSecurePassword
  132.  
  133. .. end
  134.  
  135. In case your username is other than **root**, you will
  136. need to also set it, within ``/etc/kolla/globals.yml``
  137.  
  138. .. code-block:: yaml
  139.  
  140. database_username: "privillegeduser"
  141.  
  142. .. end
  143.  
  144. Using preconfigured databases / users:
  145. ======================================
  146.  
  147. The first step you need to take is the following:
  148.  
  149. Within ``/etc/kolla/globals.yml``, set the following:
  150.  
  151. .. code-block:: yaml
  152.  
  153. use_preconfigured_databases: "yes"
  154.  
  155. .. end
  156.  
  157. Using External MariaDB with separated, preconfigured users and databases
  158. ------------------------------------------------------------------------
  159.  
  160. In order to achieve this, you will need to define the user names within
  161. ``/etc/kolla/globals.yml``, as illustrated by the example below:
  162.  
  163.  
  164. .. code-block:: yaml
  165.  
  166. keystone_database_user: preconfigureduser1
  167. nova_database_user: preconfigureduser2
  168.  
  169. .. end
  170.  
  171. You will need to also set the passwords for all databases within
  172. ``/etc/kolla/passwords.yml``
  173.  
  174.  
  175. However, fortunately, using a common user across
  176. all databases is also possible.
  177.  
  178.  
  179. Using External MariaDB with a common user across databases
  180. ----------------------------------------------------------
  181.  
  182. In order to use a common, preconfigured user across all databases,
  183. all you need to do is the following:
  184.  
  185. * Within ``/etc/kolla/globals.yml``, add the following:
  186.  
  187. .. code-block:: yaml
  188.  
  189. use_common_mariadb_user: "yes"
  190.  
  191. .. end
  192.  
  193. * Set the database_user within ``/etc/kolla/globals.yml`` to
  194. the one provided to you:
  195.  
  196. .. code-block:: yaml
  197.  
  198. database_user: mycommondatabaseuser
  199.  
  200. .. end
  201.  
  202. * Set the common password for all components within ``/etc/kolla/passwords.yml```.
  203. In order to achieve that you could use the following command:
  204.  
  205. .. code-block:: console
  206.  
  207. sed -i -r -e 's/([a-z_]{0,}database_password:+)$/\1 mycommonpass/gi' /etc/kolla/passwords.yml
  208.  
  209. .. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement