~citrix-openstack/glance/xenapi

« back to all changes in this revision

Viewing changes to doc/source/controllingservers.rst

  • Committer: Tarmac
  • Author(s): jaypipes at gmail
  • Date: 2011-02-10 01:16:58 UTC
  • mfrom: (62.3.16 use-paste-deploy)
  • Revision ID: tarmac-20110210011658-bjzu8qo36iach4mg
Removes lockfile and custom python-daemon server initialization
in favour of paste.deploy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
..
 
2
      Copyright 2011 OpenStack, LLC
 
3
      All Rights Reserved.
 
4
 
 
5
      Licensed under the Apache License, Version 2.0 (the "License"); you may
 
6
      not use this file except in compliance with the License. You may obtain
 
7
      a copy of the License at
 
8
 
 
9
          http://www.apache.org/licenses/LICENSE-2.0
 
10
 
 
11
      Unless required by applicable law or agreed to in writing, software
 
12
      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
13
      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
14
      License for the specific language governing permissions and limitations
 
15
      under the License.
 
16
 
 
17
Controlling Glance Servers
 
18
==========================
 
19
 
 
20
This section describes the ways to start, stop, and reload Glance's server
 
21
programs.
 
22
 
 
23
Starting a server
 
24
-----------------
 
25
 
 
26
There are two ways to start a Glance server (either the API server or the
 
27
reference implementation registry server that ships with Glance):
 
28
 
 
29
* Manually calling the server program
 
30
 
 
31
* Using the ``glance-control`` server daemon wrapper program
 
32
 
 
33
Manually starting the server
 
34
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
35
 
 
36
The first is by directly calling the server program, passing in command-line
 
37
options and a single argument for the ``paste.deploy`` configuration file to
 
38
use when configuring the server application.
 
39
 
 
40
.. note::
 
41
 
 
42
  Glance ships with an ``etc/`` directory that contains sample ``paste.deploy``
 
43
  configuration files that you can copy to a standard configuation directory and
 
44
  adapt for your own uses.
 
45
 
 
46
If you do `not` specifiy a configuration file on the command line, Glance will
 
47
do its best to locate a ``glance.conf`` configuration file in one of the
 
48
following directories, stopping at the first config file it finds:
 
49
 
 
50
* .
 
51
 
 
52
* ~/.glance
 
53
 
 
54
* ~/
 
55
 
 
56
* /etc/glance/
 
57
 
 
58
* /etc
 
59
 
 
60
If no configuration file is found, you will see any error, like so::
 
61
 
 
62
  $> glance-api
 
63
  ERROR: Unable to locate any configuration file. Cannot load application glance-api
 
64
 
 
65
Here is an example showing how you can manually start the ``glance-api`` server
 
66
in a shell.::
 
67
 
 
68
  $> sudo glance-api etc/glance.conf.sample --debug
 
69
  2011-02-09 14:58:29    DEBUG [glance-api] ********************************************************************************
 
70
  2011-02-09 14:58:29    DEBUG [glance-api] Configuration options gathered from config file:
 
71
  2011-02-09 14:58:29    DEBUG [glance-api] /home/jpipes/repos/glance/trunk/etc/glance.conf.sample
 
72
  2011-02-09 14:58:29    DEBUG [glance-api] ================================================
 
73
  2011-02-09 14:58:29    DEBUG [glance-api] bind_host                      0.0.0.0
 
74
  2011-02-09 14:58:29    DEBUG [glance-api] bind_port                      9292
 
75
  2011-02-09 14:58:29    DEBUG [glance-api] debug                          True
 
76
  2011-02-09 14:58:29    DEBUG [glance-api] default_store                  file
 
77
  2011-02-09 14:58:29    DEBUG [glance-api] filesystem_store_datadir       /var/lib/glance/images/
 
78
  2011-02-09 14:58:29    DEBUG [glance-api] registry_host                  0.0.0.0
 
79
  2011-02-09 14:58:29    DEBUG [glance-api] registry_port                  9191
 
80
  2011-02-09 14:58:29    DEBUG [glance-api] verbose                        False
 
81
  2011-02-09 14:58:29    DEBUG [glance-api] ********************************************************************************
 
82
  2011-02-09 14:58:29    DEBUG [routes.middleware] Initialized with method overriding = True, and path info altering = True
 
83
  (16333) wsgi starting up on http://0.0.0.0:9292/
 
84
 
 
85
Simply supply the configuration file as the first argument
 
86
(``etc/glance.conf.sample`` in the above example) and then any common options
 
87
you want to use (``--debug`` was used above to show some of the debugging
 
88
output that the server shows when starting up. Call the server program
 
89
with ``--help`` to see all available options you can specify on the
 
90
command line.)
 
91
 
 
92
For more information on configuring the server via the ``paste.deploy``
 
93
configuration files, see the section entitled
 
94
:doc:`Configuring Glance servers <configuring>`
 
95
 
 
96
Note that the server does not `daemonize` itself when run manually
 
97
from the terminal. You can force the server to daemonize using the standard
 
98
shell backgrounding indicator, ``&``. However, for most use cases, we recommend
 
99
using the ``glance-control`` server daemon wrapper for daemonizing. See below
 
100
for more details on daemonization with ``glance-control``.
 
101
 
 
102
Using the ``glance-control`` program to start the server
 
103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
104
 
 
105
The second way to start up a Glance server is to use the ``glance-control``
 
106
program. ``glance-control`` is a wrapper script that allows the user to
 
107
start, stop, restart, and reload the other Glance server programs in
 
108
a fashion that is more conducive to automation and scripting.
 
109
 
 
110
Servers started via the ``glance-control`` program are always `daemonized`,
 
111
meaning that the server program process runs in the background.
 
112
 
 
113
To start a Glance server with ``glance-control``, simply call
 
114
``glance-control`` with a server and the word "start", followed by
 
115
any command-line options you wish to provide. Start the server with ``glance-control``
 
116
in the following way::
 
117
 
 
118
  $> sudo glance-control <SERVER> start [CONFPATH]
 
119
 
 
120
.. note::
 
121
 
 
122
  You must use the ``sudo`` program to run ``glance-control`` currently, as the
 
123
  pid files for the server programs are written to /var/run/glance/
 
124
 
 
125
Here is an example that shows how to start the ``glance-registry`` server
 
126
with the ``glance-control`` wrapper script. ::
 
127
 
 
128
  $> sudo glance-control registry start etc/glance.conf.sample
 
129
  Starting glance-registry with /home/jpipes/repos/glance/trunk/etc/glance.conf.sample
 
130
 
 
131
The same ``paste.deploy`` configuration files are used by ``glance-control``
 
132
to start the Glance server programs, and you can specify (as the example above
 
133
shows) a configuration file when starting the server.
 
134
 
 
135
.. note::
 
136
 
 
137
  To start all the Glance servers (currently the glance-api and glance-registry
 
138
  programs) at once, you can specify "all" for the <SERVER>
 
139
 
 
140
Stopping a server
 
141
-----------------
 
142
 
 
143
If you started a Glance server manually and did not use the ``&`` backgrounding
 
144
function, simply send a terminate signal to the server process by typing
 
145
``Ctrl-C``
 
146
 
 
147
If you started the Glance server using the ``glance-control`` program, you can
 
148
use the ``glance-control`` program to stop it. Simply do the following::
 
149
 
 
150
  $> sudo glance-control <SERVER> stop
 
151
 
 
152
as this example shows::
 
153
 
 
154
  $> sudo glance-control registry stop
 
155
  Stopping glance-registry  pid: 17602  signal: 15
 
156
 
 
157
Restarting a server
 
158
-------------------
 
159
 
 
160
You can restart a server with the ``glance-control`` program, as demonstrated
 
161
here::
 
162
 
 
163
  $> sudo glance-control registry restart etc/glance.conf.sample
 
164
  Stopping glance-registry  pid: 17611  signal: 15
 
165
  Starting glance-registry with /home/jpipes/repos/glance/trunk/etc/glance.conf.sample