本文是基于Trove Kilo版本部署的
配置环境变量
source /opt/osdeploy/admin_openrc.sh
下载源码
1 | git clone https://github.com/openstack/trove.git /opt/openstack/trove |
安装 troveclient
1 | cd /opt/openstack/python-troveclient |
安装 trove kilo版本
1 | cd /opt/openstack/trove |
问题
IOError: [Errno 2] No such file or directory: ‘/opt/openstack/.venv/build/oslo.serialization/oslo.serialization-2.2.0.dist-info/METADATA’
解决
把build下面的所有东西都删除就行了。rm -rf /opt/openstack/.venv/build/*
创建用户
创建trove用户,trove用户添加admin角色,创建trove服务,给 trove 服务添加 api 访问地址
1 | openstack user create --password 22116ccf32a trove |
创建trove相关目录,并修改权限
1 | mkdir /opt/etc/trove; chown openstack:openstack /opt/etc/trove |
使用mysql作为trove后端db
在mysql的机器上执行:(查看/opt/etc/nova/nova.conf找到mysql服务所在机器)
1 | mysql -uroot -p |
注:需要输入mysql的密码
拷贝trove相关配置到/opt/etc/trove目录
1 | cp /opt/openstack/trove/etc/trove/api-paste.ini /opt/etc/trove/api-paste.ini |
修改/opt/etc/trove目录里的conf文件
trove.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23rabbit_hosts = 127.0.0.1:5672
rabbit_userid=openstack
rabbit_password=iafdhewak2
trove_auth_url = http://127.0.0.1:5000/v2.0
nova_compute_url = http://127.0.0.1:8774/v2
cinder_url = http://127.0.0.1:8776/v2
neutron_url = http://127.0.0.1:9696/
log_dir = /var/log/openstack/trove
log_file = trove-api.log
connection = mysql://trove:trove@127.0.0.1/trove
[keystone_authtoken]
auth_uri = http://127.0.0.1:5000
auth_url = http://127.0.0.1:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = trove
password = 221***6d42d8catrove-taskmanager.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19rabbit_host=127.0.0.1
rabbit_userid=openstack
rabbit_password=iafdhewak2
trove_auth_url = http://127.0.0.1:5000/v2.0
nova_compute_url = http://127.0.0.1:8774/v2
cinder_url = http://127.0.0.1:8776/v2
swift_url = http://127.0.0.1:8080/v1/AUTH_
neutron_url = http://127.0.0.1:9696/
log_dir = /var/log/openstack/trove
log_file = trove-taskmanager.log
# ================= Guestagent related ========================
guest_config = /opt/etc/trove/trove-guestagent.conf
injected_config_location = /etc/trove/conf.d
cloudinit_location = /opt/etc/trove/cloudinit
connection = mysql://trove:trove@127.0.0.1/trovetrove-conductor.conf
1
2
3
4
5trove_auth_url = http://127.0.0.1:5000/v2.0
rabbit_host = 127.0.0.1
rabbit_userid = openstack
rabbit_password = iafdhewak2
connection = mysql://trove:trove@127.0.0.1/trovetrove-guestagent.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25rabbit_hosts = 192.168.1.3:5672
rabbit_userid = openstack
rabbit_password = iafdhewak2
swift_url = http://192.168.1.3:8080/v1/AUTH_
os_region_name = RegionOne
swift_service_type = object-store
datastore_registry_ext = mysql:trove.guestagent.datastore.mysql.manager.Manager, percona:trove.guestagent.datastore.mysql.manager.Manager
ignore_users = os_admin
ignore_dbs = lost+found, mysql, information_schema, performance_schema
root_grant = ALL
root_grant_option = True
storage_strategy = SwiftStorage
storage_namespace = trove.guestagent.strategies.storage.swift
backup_swift_container = database_backups
[keystone_authtoken]
auth_uri = http://192.168.1.3:5000
auth_url = http://192.168.1.3:35357
auth_plugin = password
project_name = service
project_domain_id = default
user_domain_id = default
username = trove
password = 221***6d42d8ca
添加包含mysql的ubuntu镜像到glance里
1 | glance --debug image-create --name "mysql-ubuntu" --file ~/mysql.qcow2 --disk-format qcow2 --container-format bare --is-public True --progress |
初始化trove database
因为mysql外键的问题,可能需要执行括号内的额外步骤:
1 | [mysql -uroot -ppwd -e"use trove;SET GLOBAL foreign_key_checks=0;"] |
初始化Trove Datastores
1 | export DATASTORE_TYPE="mysql" |
重启trove service
1 | service trove-api restart; service trove-taskmanager restart; service trove-conductor restart; |
配置datastore的默认值
修改trove.conf,在[default]字段添加:
1 | default_datastore = mysql |
查看datastore mysql的default version值:
1 | $ trove datastore-show mysql |
配置mysql, 5.6版本的config parameters
1 | trove-manage --config-file /opt/etc/trove/trove.conf db_load_datastore_config_parameters mysql 5.6 /opt/openstack/trove/trove/templates/mysql/validation-rules.json |
参考资料
http://docs.openstack.org/kilo/config-reference/content/ch_configuring-trove.html
http://docs.openstack.org/developer/trove/dev/manual_install.html
https://github.com/openstack/trove/blob/master/doc/source/dev/manual_install.rst
https://www.youtube.com/watch?v=zk42zzc_38o
http://blog.csdn.net/myproudcodelife/article/details/39839891