Convert default from MongoDB to MySQL storage
In Mitaka the default storage engine was changed and the current storage engine (MongoDB) was deprecated. Support for MongoDB storage may be removed upstream during the O* cycle. Now that a migration path is possible, we should begin the shift. Change-Id: I94a585f9c1da51c4f278f4a12e29d395a261e716 Related: change I03b5dd14160dba37c992d04275155f7d9037edb0 Related: change Ibfc47ebe0652b38dbc708d2a0ab58a4288230228 Related: blueprint only-support-sqlalchemy-in-aodh Upgrade-Impact: db create and data migration becomes necessary Upgrade-Related: change If0ac3e530ab007118dfd5b842826ba95613ac61d
This commit is contained in:
parent
25db7ac26b
commit
ae2e55beed
|
@ -48,10 +48,9 @@ aodh_system_user_home: "/var/lib/{{ aodh_system_user_name }}"
|
|||
## DB info
|
||||
aodh_database_name: aodh
|
||||
aodh_database_user: aodh
|
||||
aodh_db_type: mongodb
|
||||
aodh_db_ip: localhost
|
||||
aodh_db_port: 27017
|
||||
aodh_connection_string: "{{ aodh_db_type }}://{{ aodh_database_user }}:{{ aodh_container_db_password }}@{{ aodh_db_ip }}:{{ aodh_db_port }}/{{ aodh_database_name }}"
|
||||
aodh_db_type: "mysql+pymysql"
|
||||
aodh_db_address: localhost
|
||||
aodh_connection_string: "{{ aodh_db_type }}://{{ aodh_database_user }}:{{ aodh_container_db_password }}@{{ aodh_db_address }}/{{ aodh_database_name }}?charset=utf8"
|
||||
|
||||
## RabbitMQ info
|
||||
aodh_rabbitmq_userid: aodh
|
||||
|
@ -97,13 +96,13 @@ aodh_requires_pip_packages:
|
|||
|
||||
# Common pip packages
|
||||
aodh_pip_packages:
|
||||
- aodh
|
||||
- "aodh[mysql]"
|
||||
- python-ceilometerclient
|
||||
- ceilometermiddleware
|
||||
- python-memcached
|
||||
- pycrypto
|
||||
- warlock
|
||||
- pymongo
|
||||
- PyMySQL
|
||||
|
||||
## Service Names
|
||||
aodh_service_names:
|
||||
|
|
|
@ -35,4 +35,5 @@ dependencies:
|
|||
- role: apt_package_pinning
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- galera_client
|
||||
- openstack_openrc
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
# Copyright 2016, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Perform a Aodh DB sync
|
||||
command: "{{ aodh_bin }}/aodh-dbsync"
|
||||
become: yes
|
||||
become_user: "{{ aodh_system_user_name }}"
|
||||
tags:
|
||||
- aodh-db-sync
|
||||
- aodh-setup
|
||||
- aodh-command-bin
|
|
@ -37,6 +37,10 @@
|
|||
- include: aodh_post_install.yml
|
||||
- include: aodh_upstart_init.yml
|
||||
|
||||
- include: aodh_db_setup.yml
|
||||
when: >
|
||||
inventory_hostname == groups['aodh_all'][0]
|
||||
|
||||
- include: aodh_service_setup.yml
|
||||
when: >
|
||||
inventory_hostname == groups['aodh_api'][0]
|
||||
|
|
|
@ -1,2 +1,25 @@
|
|||
[all]
|
||||
localhost ansible_connection=local ansible_become=True
|
||||
infra1 ansible_ssh_host=10.100.100.2 ansible_host=10.100.100.2 ansible_become=True ansible_user=root
|
||||
openstack1 ansible_ssh_host=10.100.100.3 ansible_host=10.100.100.3 ansible_become=True ansible_user=root
|
||||
|
||||
|
||||
[all_containers]
|
||||
infra1
|
||||
openstack1
|
||||
|
||||
[rabbitmq_all]
|
||||
infra1
|
||||
|
||||
[galera_all]
|
||||
infra1
|
||||
|
||||
[service_all:children]
|
||||
rabbitmq_all
|
||||
galera_all
|
||||
|
||||
[keystone_all]
|
||||
openstack1
|
||||
|
||||
[aodh_all]
|
||||
openstack1
|
|
@ -126,52 +126,17 @@
|
|||
hosts: service_all
|
||||
user: root
|
||||
gather_facts: true
|
||||
pre_tasks:
|
||||
- name: Install MongoDB packages
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: packages_mongodb
|
||||
- name: Configure the MongoDB bind address
|
||||
lineinfile:
|
||||
dest: /etc/mongodb.conf
|
||||
regexp: "^(#)?bind_ip"
|
||||
line: "bind_ip = 10.100.100.2"
|
||||
register: mongodb_bind
|
||||
- name: Enable the MongoDB smallfiles option
|
||||
lineinfile:
|
||||
dest: /etc/mongodb.conf
|
||||
regexp: "^(#)?smallfiles"
|
||||
line: "smallfiles = true"
|
||||
register: mongodb_smallfiles
|
||||
- name: Restart mongodb
|
||||
service:
|
||||
name: mongodb
|
||||
state: restarted
|
||||
when:
|
||||
- mongodb_bind | changed or mongodb_smallfiles | changed
|
||||
register: mongodb_restart
|
||||
- name: Wait for mongodb to come back online after the restart
|
||||
wait_for:
|
||||
host: "10.100.100.2"
|
||||
port: 27017
|
||||
delay: 10
|
||||
timeout: 120
|
||||
when:
|
||||
- mongodb_restart is defined
|
||||
- mongodb_restart | changed
|
||||
- name: Test mongodb connectivity
|
||||
command: "mongo --host 10.100.100.2 --eval ' '"
|
||||
changed_when: False
|
||||
- name: Add aodh database user
|
||||
mongodb_user:
|
||||
login_host: "10.100.100.2"
|
||||
database: aodh
|
||||
name: aodh
|
||||
password: secrete
|
||||
roles: 'readWrite,dbAdmin'
|
||||
state: present
|
||||
roles:
|
||||
- role: "galera_server"
|
||||
galera_root_password: secrete
|
||||
galera_root_user: root
|
||||
galera_innodb_buffer_pool_size: 512M
|
||||
galera_innodb_log_buffer_size: 32M
|
||||
galera_server_id: "{{ inventory_hostname | string_2_int }}"
|
||||
galera_wsrep_node_name: "{{ inventory_hostname }}"
|
||||
galera_wsrep_provider_options:
|
||||
- { option: "gcache.size", value: "32M" }
|
||||
galera_server_id: "{{ inventory_hostname | string_2_int }}"
|
||||
- role: "rabbitmq_server"
|
||||
rabbitmq_cookie_token: secrete
|
||||
- role: "galera_server"
|
||||
|
@ -281,6 +246,30 @@
|
|||
state: "present"
|
||||
delegate_to: "10.100.100.2"
|
||||
when: inventory_hostname == groups['aodh_all'][0]
|
||||
- name: Create DB for service
|
||||
mysql_db:
|
||||
login_user: "root"
|
||||
login_password: "secrete"
|
||||
login_host: "localhost"
|
||||
name: "{{ aodh_database_name }}"
|
||||
state: "present"
|
||||
delegate_to: "10.100.100.2"
|
||||
when: inventory_hostname == groups['aodh_all'][0]
|
||||
- name: Grant access to the DB for the service
|
||||
mysql_user:
|
||||
login_user: "root"
|
||||
login_password: "secrete"
|
||||
login_host: "localhost"
|
||||
name: "{{ aodh_database_name }}"
|
||||
password: "{{ aodh_container_db_password }}"
|
||||
host: "{{ item }}"
|
||||
state: "present"
|
||||
priv: "{{ aodh_database_name }}.*:ALL"
|
||||
with_items:
|
||||
- "localhost"
|
||||
- "%"
|
||||
delegate_to: "10.100.100.2"
|
||||
when: inventory_hostname == groups['aodh_all'][0]
|
||||
roles:
|
||||
- role: "{{ rolename | basename }}"
|
||||
tasks:
|
||||
|
@ -293,7 +282,8 @@
|
|||
internal_lb_vip_address: 10.100.100.3
|
||||
galera_root_password: "secrete"
|
||||
aodh_container_db_password: "secrete"
|
||||
aodh_db_ip: 10.100.100.2
|
||||
aodh_db_address: 10.100.100.2
|
||||
aodh_database_name: aodh
|
||||
galera_client_drop_config_file: false
|
||||
aodh_rabbitmq_password: "secrete"
|
||||
aodh_rabbitmq_userid: aodh
|
||||
|
|
Loading…
Reference in New Issue