Goal
This file provides step-by-step instructions for manually installing trove in an existing openstack environment in order to develop.
The file will not include:
Settings for OpenStack
Trove Service Configuration
Requirements
The environment of the running OpenStack is required, including the following components:
Calculation (Nova)
Mirroring Service (Glance)
Identity Verification (Keystone)
One network component (either Neutron or nova-network)
If you want to provide data storage on a block storage volume, you also need block storage (Cinder)
If you want to do backup/restore and replication, you also need object storage (Swift)
Run the trove service in an environment that has just installed Ubuntu14.04 lts. This will be referred to as the "local environment"
AMQP Service (RABBITMQ or Qpid)
The MySQL (sqlite,postgresql) database is used to meet the internal needs of trove and is accessed from the local environment.
Some OpenStack services must be accessible from a virtual machine:
Swift
Virtual machines must be accessed from the local environment for development/debugging
OpenStack services must be accessed directly from the local environment, for example:
Nova
Cinder
Swift
Heat
Installation
Collect information
The following information is required for an existing environment:
Keystone Host and Port (S)
User name, tenant name and password for OpenStack administrator
Nova's URL
URL of Cinder
Swift's URL
URL of heat
AMQP connection credentials (server URL, user password)
Trove controller-side connection strings (MySQL and SQLite, PostgreSQL)
Installation dependencies
Required packages for trove¶
List of packages to install:
$ sudo apt-get install build-essential libxslt1-dev qemu-utils mysql-client \
git python-dev python-pexpect python-pymysql libmysqlclient-dev
Settings for Python
To find out which version of Setuptools is up-to-date, check the Setuptools repo.
To find out which PIP version is up to date, please visit Pip's repo.
Some packages are obsolete in the Ubuntu software warehouse. Be sure to update the latest version from the appropriate source.
Use the latest Setuptools:
$ cd ~
$ wget https://pypi.python.org/packages/source/s/setuptools/setuptools-{{latest}}.tar.gz
$ tar xfvz setuptools-{{latest}}.tar.gz
$ cd Setuptools-{{latest}}
$ python setup.py Install--user
Use the latest Pip:
$ wget https://pypi.python.org/packages/source/p/pip/pip-{{latest}}.tar.gz
$ tar xfvz pip-{{latest}}.tar.gz
$ cd Pip-{{latest}}
$ python setup.py Install--user
Note the above '-user '-we install the package in the user's HOME directory, in $home/.local/bin, so we need to add it to the environment variable:
$ echo path= "$HOME/.local/bin: $PATH" >> ~/.profile
$ . ~/.profile
Install VIRTUALENV, create an environment, and activate it:
$ pip Install virtualenv--user
$ virtualenv--system-site-packages env
$ source Env/bin/activate
Get trove
Get the trove source component in the OpenStack repository:
$ cd ~
$ git clone https://git.openstack.org/openstack/trove.git
$ git clone https://git.openstack.org/openstack/python-troveclient.git
Installing trove¶
First, the installation requirements:
$ CD ~/trove
$ pip install-r requirements.txt-r test-requirements.txt
Then install trove
$ sudo python setup.py develop
Finally install trove Client
$ CD ~/python-troveclient
$ sudo python setup.py develop
$ cd ~
Other required OpenStack clients (python-novaclient,python-keystoneclient, etc.) should already be installed as part of the trove.
Prepare trove for OpenStack:
You first need to create a tenant named "Trove_for_trove_usage." Next, create the user named "Regular_trove_user" and "Admin_trove_user"-use "treasure trove" as the password. These are the accounts used to provide the trove service. Additionally, you will need to register trove as the OpenStack service and its endpoints:
$ Keystone--os-username <OpenStackAdminUsername>--os-password <OpenStackAdminPassword>-- Os-tenant-name <OpenStackAdminTenant>--os-auth-url http://<KeystoneIP>:<KeystonePort>/v2.0 Tenant-create--user Trove_for_trove_usage
$ Keystone--os-username <OpenStackAdminUsername>--os-password <OpenStackAdminPassword>-- Os-tenant-name <OpenStackAdminTenant>--os-auth-url http://<KeystoneIP>:<KeystonePort>/v2.0 User-create--user regular_trove_user--pass trove--tenant trove_for_trove_usage
$ Keystone--os-username <OpenStackAdminUsername>--os-password <OpenStackAdminPassword>-- Os-tenant-name <OpenStackAdminTenant>--os-auth-url http://<KeystoneIP>:<KeystonePort>/v2.0 User-create--user admin_trove_user--pass trove--tenant trove_for_trove_usage
$ Keystone--os-username <OpenStackAdminUsername>--os-password <OpenStackAdminPassword>-- Os-tenant-name <OpenStackAdminTenant>--os-auth-url http://<KeystoneIP>:<KeystonePort>/v2.0 User-role-add--user admin_trove_user--tenant trove_for_trove_usage--role Admin
$ Keystone--os-username <OpenStackAdminUsername>--os-password <OpenStackAdminPassword>-- Os-tenant-name <OpenStackAdminTenant>--os-auth-url http://<KeystoneIP>:<KeystonePort>/v2.0 Service-create--user trove--type Database
$ Keystone--os-username <OpenStackAdminUsername>--os-password <OpenStackAdminPassword>-- Os-tenant-name <OpenStackAdminTenant>--os-auth-url http://<KeystoneIP>:<KeystonePort>/v2.0 Endpoint-create--service trove--region regionone--publicurl ' http://<environmentpublicip>:< environmentport>/v1.0/$ (tenant_id) s '--adminurl ' http://<EnvironmentPublicIP>:<EnvironmentPort>/ v1.0/$ (tenant_id) s '--internalurl ' http://<environmentpublicip>:<environmentport>/v1.0/$ (tenant_id) s ‘
where,<environmentpublicip> and <EnvironmentPort> refer to the IP address and port of the server where the trove is installed. The IP should be able to access any host that wants to communicate with trove.
Preparing the trove configuration file ¶
There are several trove configuration files:
Api-paste.ini and Trove.conf-trove-api Services
Trove-taskmanager.conf-trove-taskmanager Service
Trove-guestagent.conf-trove-guestagent Service
Trove-conductor.conf-trove-conductor Service
<datastore_manager>.cloudinit-user data during virtual machine provisioning
Cloud-init scripts is a user data that is used for different data storage types, such as Mysql/percona, Cassandra,mongodb, Redis, and couchbase while providing new compute instances.
The above example is in: ~/trove/etc/trove/as *.conf.sample files.
If a clean Ubuntu image is used for trove instance source mirroring, Cloud-init scripts must be installed and run guestagent in the instance.
As an alternative, you might consider creating a custom image with pre-installed and preconfigured trove.
Source image
As for the trove instance source image, we will use the Trove compatible Ubuntu image:
$ export datastore_type= "MySQL"
$ wget http://tarballs.openstack.org/trove/images/ubuntu/${datastore_type}. qcow2
${datastore_type}. qcow2
Note: http://tarballs.openstack.org/trove/images includes MySQL and Percona, MongoDB trove compatible images.
In this step, remember the image ID or stored in an environment variable (IMAGEID).
$ glance--os-username trove--os-password trove--os-tenant-name trove--os-auth-url http://<keystoneip>:< keystoneadminport>/v2.0
Image-create--name trove-image--is-public true--container-format ovf--disk-format qcow2--owner trove < Precise.qco W2
$ Export Imageid=<glance_image_id>
Cloud-init scripts
Cloud-init Location
By default, Trove-taskmanager will focus on/etc/trove/cloudinit for <datastore_manager>.cloudinit.
Cloud-init Content
Each cloud-init script for a trove compatible image should contain:
Installation of Trove
Custom image with trove code
Waiting to be added
Prepare the database
To create the trove database schema:
Connecting to the storage backend (mysql,postgresql)
Create the database with the name trove (this database will be used to store the trove ORM)
The composition of the connection string. Example: MYSQL + pymysql://< user >:< password >@ <backend_host>:<backend_port>/< database >
Initializing the database
Once the trove database has been created, its structure needs to be populated.
$ trove-manage Db_sync
Setting up the Trove data store
Data storage
A data store is a data structure that describes a set of datastore versions that contain:
-ID--Simple auto-generated UUID
-Name--user-defined attribute, actual name of a datastore
-Datastore Versions
For example:
-MySQL, Cassandra, Redis, etc.
Data store version
A data store version is a data structure that describes a version that is pinned to a data store-specific database, which includes:
-Id-simple auto-generated UUID
-Datastore id-reference to Datastore
-name-user-defined attribute, actual Name of a database version
-Datastore Manager-trove-guestagent Manager that's used for Datastore management
-Image id-reference to a specific Glance image ID
-Packages-operating system specific Packages that would be deployed onto Datastore VM
-Active-boolean flag that defines if version can is used for instance deployment or not
For example:
-id-edb1d22a-b66d-4e86-be60-756240439272
-Datastore id-9c3d890b-a2f2-4ba5-91b2-2997d0791502
-name-mysql-5.6
-Datastore Manager-mysql
-Image id-d73a402-3953-4721-8c99-86fc72e1cb51
-packages-mysql-server=5.5, percona-xtrabackup=2.1
-Active-true
Data storage and data store version registration
To register the data store, you must perform
# available Options:mysql, MongoDB, PostgreSQL, Redis, Cassandra, Couchbase, Couchdb, DB2, Vertica, etc.
# available Options:for Cassandra 2.0.x, for mysql:5.x, for mongodb:2.x.x, etc.
# available options:cassandra=2.0.9, mongodb=2.0.4, etc
# Glance Image ID of the relevant Datastore version (see Source images section)
${datastore_type} ""
${datastore_type} ${datastore_version} ${datastore_type} ${IMAGEID} ${PACKAGES} 1
${datastore_type} ${datastore_version}
Run trove
Trove Service configuration and tuning¶
Waiting to be added
Start trove Service
To run the Trove API:
$ trove-api--config-file=${trove_conf_dir}/trove-api.conf &
Run Trove-taskmanager:
$ trove-taskmanager--config-file=${trove_conf_dir}/trove-taskamanger.conf &
Run Trove-conductor:
$ trove-conductor--config-file=${trove_conf_dir}/trove-conductor.conf &
Trove Interactive
Keystonerc
You need to build a Kenstonerc file that contains data to simplify the authentication process when using the client:
Export Os_tenant_name=trove
Export Os_username=regular_trove_user
Export Os_password=trove
Export Os_auth_url= "http://<KeystoneIP>:<KeystonePort>/v2.0/"
Export Os_auth_strategy=keystone
Trove Deployment Verification
First, you need to perform:
$ . Keystonerc
To view help for a particular command:
$ trove Help <command>
Create a use case:
$ trove Create <name> <flavor_id>
[--size <size>]
[--databases <databases> [<databases> ...]
[--users <users> [<users> ...] [--backup <backup>]
[--availability_zone <availability_zone>]
[--datastore <datastore>]
[--datastore_version <datastore_version>]
[--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,port-id=port-uuid>]
[--configuration <configuration>]
[--replica_of <source_id>]
Trouble shooting
IPs with no instances in ' Trove show <instance_id> ' command output
If the trove instance is created successfully, the active state and work are displayed, but no IP address is displayed, in the output of the command ' trove show <instance_id> ', and then confirm that the following line is added to the trove.conf
Network_label_regex = ^network_name$
Network_name should be replaced with an instance of the real name to connect to the network.
Decide which network you want to attach a trove instance to, and run the following command:
$ Nova Net-list
Or
$ neutron Net-list
One possible way to find the network name is to perform the "Nova List" command. The output lists all OpenStack instances, including network information, for the tenant.
Like what:
Network_name=ip_address
More information: http://www.cnblogs.com/S-tec-songjian/
Trove Manual Installation Translation