diff --git a/ansible/roles/bootstrap.yml b/ansible/roles/bootstrap.yml index 84799d7d89..d3fdd83544 100644 --- a/ansible/roles/bootstrap.yml +++ b/ansible/roles/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ mariadb_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ service_database_name }}'" @@ -15,6 +16,7 @@ command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ mariadb_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ service_database_name }}' diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 index 57a2ab542f..257989bd38 100644 --- a/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -16,13 +16,11 @@ defaults listen mariadb mode tcp - option mysql-check user haproxy option tcpka - - # TODO(SamYaple): Make DB port configurable throughout Ansible - bind {{ kolla_internal_address }}:3306 + option mysql-check user haproxy + bind {{ kolla_internal_address }}:{{ mariadb_port }} {% for host in groups['mariadb'] %} - server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:3306 check inter 2000 rise 2 fall 5 {% if not loop.first %}backup{% endif %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_port }} check inter 2000 rise 2 fall 5 {% if not loop.first %}backup{% endif %} {% endfor %} diff --git a/ansible/roles/keystone/tasks/bootstrap.yml b/ansible/roles/keystone/tasks/bootstrap.yml index 91485a3cc0..bad18ed19b 100644 --- a/ansible/roles/keystone/tasks/bootstrap.yml +++ b/ansible/roles/keystone/tasks/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ mariadb_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ keystone_database_name }}'" @@ -15,6 +16,7 @@ command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ mariadb_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ keystone_database_name }}' diff --git a/ansible/roles/mariadb/defaults/main.yml b/ansible/roles/mariadb/defaults/main.yml index 48285a7104..2be21a4bce 100644 --- a/ansible/roles/mariadb/defaults/main.yml +++ b/ansible/roles/mariadb/defaults/main.yml @@ -4,7 +4,7 @@ project_name: "mariadb" #################### # Database #################### -database_cluster_name: "kolla" +database_cluster_name: "openstack" #################### diff --git a/ansible/roles/mariadb/tasks/register.yml b/ansible/roles/mariadb/tasks/register.yml index 652545856e..9285bb9a52 100644 --- a/ansible/roles/mariadb/tasks/register.yml +++ b/ansible/roles/mariadb/tasks/register.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}' + login_port='{{ mariadb_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='haproxy' diff --git a/ansible/roles/mariadb/templates/galera.cnf.j2 b/ansible/roles/mariadb/templates/galera.cnf.j2 index 271d12d7ec..c44bce951d 100644 --- a/ansible/roles/mariadb/templates/galera.cnf.j2 +++ b/ansible/roles/mariadb/templates/galera.cnf.j2 @@ -1,17 +1,20 @@ [mysqld] bind-address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} +port={{ mariadb_port }} + binlog_format=ROW default-storage-engine=innodb innodb_autoinc_lock_mode=2 -query_cache_size=0 -query_cache_type=0 -innodb_log_file_size=48M + +wsrep_cluster_address=gcomm://{% if (groups['mariadb'] | length) > 1 %}{% for host in groups['mariadb'] %}{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_wsrep_port }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %} + +wsrep_provider_options="gmcast.listen_addr=tcp://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_wsrep_port }};ist.recv_addr={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_ist_port }}" + +wsrep_node_address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_wsrep_port }} +wsrep_sst_receive_address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_sst_port }} wsrep_provider=/usr/lib64/galera/libgalera_smm.so -wsrep_cluster_address=gcomm://{% if (groups['mariadb'] | length) > 1 %}{% for host in groups['mariadb'] %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %} - wsrep_cluster_name="{{ database_cluster_name }}" -wsrep_node_address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} wsrep_node_name={{ ansible_hostname }} wsrep_sst_method=xtrabackup-v2 wsrep_sst_auth={{ database_user }}:{{ database_password }} diff --git a/etc/kolla/defaults.yml b/etc/kolla/defaults.yml index 1183931525..8b096cb0ea 100644 --- a/etc/kolla/defaults.yml +++ b/etc/kolla/defaults.yml @@ -23,6 +23,11 @@ node_config_directory: "/opt/kolla/config" # the different services. This prevents setting the ports in the defaults for # each role. +mariadb_port: "3306" +mariadb_wsrep_port: "4567" +mariadb_ist_port: "4568" +mariadb_sst_port: "4444" + rabbitmq_port: "5672" rabbitmq_management_port: "15672" rabbitmq_cluster_port: "25672"