1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
.. _manual_install:
=========================
Manual Trove Installation
=========================
Objectives
==========
This document is aimed to provide a step-by-step guide for manual installation of Trove with an existing OpenStack
environment for development purposes.
This document does not cover OpenStack setup.
This document does not cover production-specific moments like high availability or security.
This document does not cover all possible configurations. It only provides one possible way to get things
running.
Requirements
============
- PC with freshly installed Ubuntu 12.04 to run Trove services. This will be referred to as "local PC"
- Running OpenStack Grizzly environment. All of Grizzly's services must be accessible directly from the local PC
- AMQP service provided by RabbitMQ
- MySQL database for Trove's internal needs, accessible from the local PC
- Though it is not required by OpenStack itself, all OpenStack services must be accessible via network from virtual machines
- Trove's database must be accessible from VMs, i.e. one must be able to connect to DB from VM
- VMs must be accessible from local PC (same network)
Installation
============
-----------
Gather info
-----------
..
TODO: Requirements below (e.g. admin credentials) are obviously excessive. Try to use regular account.
The following information about existing environment is required:
- Keystone host and port(s)
- OpenStack administrator's username, tenant and password
- Nova compute URL
- Cinder URL
- Swift URL
- RabbitMQ URL, user Id, password
- Trove's MySQL connection string
--------------------
Install dependencies
--------------------
* Install required packages::
# sudo apt-get install build-essential libxslt1-dev qemu-utils mysql-client git python-dev python-pexpect python-mysqldb libmysqlclient-dev
* Some packages in Ubuntu repo are outdated, so install their latest version from sources::
# cd ~
# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.9.8.tar.gz
# tar xfvz setuptools-0.9.8.tar.gz
# cd setuptools-0.9.8
# python setup.py install --user
# cd ~
# wget https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz
# tar xfvz pip-1.4.1.tar.gz
# cd pip-1.4.1
# python setup.py install --user
# cd ~
* Note '--user' above -- we installed packages in user's home dir, in $HOME/.local/bin, so we need to add it to path::
# echo PATH="$HOME/.local/bin:$PATH" >> ~/.profile
# . ~/.profile
* Install virtualenv, create environment and activate it::
# pip install virtualenv --user
# virtualenv --system-site-packages env
# . env/bin/activate
------------
Obtain Trove
------------
* Get Trove's sources from git::
# git clone https://github.com/openstack/trove.git
# git clone https://github.com/openstack/python-troveclient.git
-------------
Install Trove
-------------
* First install required python packages::
# cd ~/trove
# pip install -r requirements.txt
* Resolve dependency conflicts (if there are any)
Trove is being built and tested against latest versions of OpenStack components that can be obtained from GitHub.
But setup downloads dependencies from PyPI which may contain outdated versions. This may cause a dependency conflicts.
E.g. for now python-cinderclient from PyPI requires older 'requests' than one installed by default, so fix it manually::
# pip install --upgrade 'requests<1.2.3'
or consider manual installing fresh OpenStack components from GitHub
* Install Trove itself::
# python setup.py develop
* Install Trove CLI::
# cd ~/python-troveclient
# python setup.py develop
# cd ~
* We'll need glance client as well::
# pip install python-glanceclient
-----------------
Prepare OpenStack
-----------------
* Create a tenant 'trove' and user 'trove' with password 'trove' to be used with Trove.
These values are not required to all be 'trove'; you can instead choose your own values for the name,
tenant, and password::
# keystone --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword>
--os-tenant-name <OpenStackAdminTenant> --os-auth-url http://<KeystoneIp>:35357/v2.0
tenant-create --name trove
# keystone --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword>
--os-tenant-name <OpenStackAdminTenant> --os-auth-url http://<KeystoneIp>:35357/v2.0
user-create --name trove --pass trove --tenant trove
# keystone --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword>
--os-tenant-name <OpenStackAdminTenant> --os-auth-url http://<KeystoneIp>:35357/v2.0
user-role-add --name trove --tenant trove --role admin
* Create service for trove::
# keystone --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword>
--os-tenant-name <OpenStackAdminTenant> --os-auth-url http://<KeystoneIp>:35357/v2.0
service-create --name trove --type database
* Create an endpoint that points to localhost. Pay attention to the use of quotes (')::
# keystone --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword>
--os-tenant-name <OpenStackAdminTenant> --os-auth-url http://<KeystoneIp>:35357/v2.0
endpoint-create --service trove --region RegionOne
--publicurl 'http://localhost:8779/v1.0/$(tenant_id)s'
--adminurl 'http://localhost:8779/v1.0/$(tenant_id)s'
--internalurl 'http://localhost:8779/v1.0/$(tenant_id)s'
---------------------------------
Prepare Trove configuration files
---------------------------------
There are several configuration files for Trove:
- api-paste.ini and trove.conf -- for trove-api
- trove-taskmanager.conf -- for trove-taskmanager
- trove-guestagent.conf -- for trove-guestagent
- <service_type>.cloudinit -- cloudinit scripts for different service types. For now only 'mysql' and 'percona' are recognized as valid service types. NOTE: file names must exactly follow the pattern, e.g. 'mysql.cloudinit'
Samples of the above are available in $TROVE/trove/etc/trove/ as *.conf.sample files.
If a vanilla Ubuntu image used as a source image for Trove instances, then it is cloudinit script's responsibility
to install and run Trove guestagent in the instance.
As an alternative one may consider creating a custom image with pre-installed and pre-configured Trove in it.
-------------
Prepare image
-------------
* As the source image for trove instances, we will use a cloudinit-enabled vanilla Ubuntu image::
# wget http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
* Convert the downloaded image into uncompressed qcow2::
# qemu-img convert -O qcow2 precise-server-cloudimg-amd64-disk1.img precise.qcow2
* Upload the converted image into Glance::
# glance --os-username trove --os-password trove --os-tenant-name trove --os-auth-url http://<KeystoneIp>:35357/v2.0
image-create --name trove-image --public --container-format ovf --disk-format qcow2 --owner trove < precise.qcow2
----------------
Prepare database
----------------
* Initialize the database::
# trove-manage --config-file=<PathToTroveConf> db_recreate trove_test.sqlite mysql fake
* Setup trove to use the uploaded image. Enter the following in a single line, note quotes (') and backquotes(`)::
# trove-manage --config-file=<PathToTroveConf> image_update mysql
`nova --os-username trove --os-password trove --os-tenant-name trove
--os-auth-url http://<KeystoneIp>:5000/v2.0 image-list | awk '/trove-image/ {print $2}'`
---------
Run Trove
---------
* Run trove-api::
# trove-api --config-file=<PathToTroveConf> &
* Run trove-taskmanager::
# trove-taskmanager --config-file=<PathToTroveTaskmanagerConf> &
* Try executing a trove command, like get-instance. You must first issue an "auth login" to obtain an API key.::
# trove-cli --username=trove --apikey=trove --tenant=trove --auth_url=http://<KeystoneIp>:35357/v2.0/tokens auth login
# trove-cli instance list
Troubleshooting
===============
-------------
No instance IPs in the output of 'trove-cli instance get'
-------------
If Trove instance is created properly, is in the state ACTIVE, and is known for sure to be working,
but there are no IP addresses for the instance in the output of 'trove-cli instance get <id>', then make sure
the following lines are added to trove.conf::
add_addresses = True
network_label_regex = ^NETWORK_NAME$
where NETWORK_NAME should be replaced with real name of the nova network to which the instance is connected to.
One possible way to find the nova network name is to execute the 'nova list' command. The output will list
all OpenStack instances for the tenant, including network information. Look for ::
NETWORK_NAME=IP_ADDRESS
|