tyrantmanager 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +28 -0
- data/LICENSE +13 -0
- data/README +273 -0
- data/bin/tyrantmanager +10 -0
- data/data/config.rb +94 -0
- data/data/default_instance_config.rb +244 -0
- data/gemspec.rb +51 -0
- data/lib/tyrant_manager/cli.rb +145 -0
- data/lib/tyrant_manager/command.rb +118 -0
- data/lib/tyrant_manager/commands/create_instance.rb +27 -0
- data/lib/tyrant_manager/commands/list.rb +28 -0
- data/lib/tyrant_manager/commands/start.rb +32 -0
- data/lib/tyrant_manager/commands/stats.rb +25 -0
- data/lib/tyrant_manager/commands/status.rb +22 -0
- data/lib/tyrant_manager/commands/stop.rb +23 -0
- data/lib/tyrant_manager/log.rb +91 -0
- data/lib/tyrant_manager/paths.rb +77 -0
- data/lib/tyrant_manager/runner.rb +33 -0
- data/lib/tyrant_manager/tyrant_instance.rb +340 -0
- data/lib/tyrant_manager/version.rb +27 -0
- data/lib/tyrant_manager.rb +237 -0
- data/lib/tyrantmanager.rb +2 -0
- data/spec/command_spec.rb +37 -0
- data/spec/paths_spec.rb +57 -0
- data/spec/spec_helper.rb +58 -0
- data/spec/tyrant_instance_spec.rb +83 -0
- data/spec/tyrant_manager_spec.rb +69 -0
- data/spec/version_spec.rb +16 -0
- data/tasks/announce.rake +43 -0
- data/tasks/config.rb +99 -0
- data/tasks/distribution.rake +38 -0
- data/tasks/documentation.rake +32 -0
- data/tasks/rspec.rake +29 -0
- data/tasks/rubyforge.rake +51 -0
- data/tasks/utils.rb +80 -0
- metadata +144 -0
data/HISTORY
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
= Changelog
|
2
|
+
== Version 1.0.9 2009-08-01
|
3
|
+
|
4
|
+
* First public versioned release
|
5
|
+
|
6
|
+
== Version 1.0.8
|
7
|
+
|
8
|
+
* start the instance in the context of its home directory
|
9
|
+
|
10
|
+
== Version 1.0.7
|
11
|
+
|
12
|
+
* do not attempt to stop servers where there is no pid file
|
13
|
+
|
14
|
+
== Version 1.0.6
|
15
|
+
|
16
|
+
* updates to list command
|
17
|
+
|
18
|
+
== Version 1.0.4
|
19
|
+
|
20
|
+
* fix db name on ttserver commandline, make sure opts/mode/etc are correct
|
21
|
+
|
22
|
+
== Version 1.0.1
|
23
|
+
|
24
|
+
* fix default home directory in cli
|
25
|
+
|
26
|
+
== Version 1.0.0
|
27
|
+
|
28
|
+
* Initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2009, Jeremy Hinegardner
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
9
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,273 @@
|
|
1
|
+
== Tyrant Manager
|
2
|
+
|
3
|
+
* Homepage[http://copiousfreetime.rubyforge.org/tokyo-manager]
|
4
|
+
* {Rubyforge project}[http://rubyforge.org/projects/copiousfreetime/]
|
5
|
+
* email jeremy at copiousfreetime dot org
|
6
|
+
* git clone git://github.com/copiousfreetime/tokyo-manager.git
|
7
|
+
|
8
|
+
== INSTALLATION
|
9
|
+
|
10
|
+
sudo gem install tyrantmanager
|
11
|
+
|
12
|
+
== SYNOPSIS
|
13
|
+
|
14
|
+
tyrantmanager (setup|create-instance|start|stop|status|stats|list) [options]+
|
15
|
+
|
16
|
+
== DESCRIPTION
|
17
|
+
|
18
|
+
A command line tool for managing Tokyo Tyrant instances.
|
19
|
+
|
20
|
+
=== Setup a manager home
|
21
|
+
|
22
|
+
After installing the gem, you need to setup a tyrant manager home, all the
|
23
|
+
tyrant instances are initially relative to this location.
|
24
|
+
|
25
|
+
jeremy@playground:~ % tyrantmanager setup /tmp/tyrant
|
26
|
+
00:09:06 INFO : Creating directory /tmp/tyrant
|
27
|
+
00:09:06 INFO : Creating default config file /tmp/tyrant/config.rb
|
28
|
+
00:09:06 INFO : Creating directory /tmp/tyrant/instances
|
29
|
+
00:09:06 INFO : Creating directory /tmp/tyrant/log
|
30
|
+
00:09:06 INFO : Creating directory /tmp/tyrant/tmp
|
31
|
+
|
32
|
+
Once the manager home is setup, all other commands need to know about it.
|
33
|
+
This can be achieved in 3 ways.
|
34
|
+
|
35
|
+
* use the --home option on all commands
|
36
|
+
* set the TYRANT_MANAGER_HOME environment variable
|
37
|
+
* execute the commands when the current working directory is the tyrant home.
|
38
|
+
|
39
|
+
=== Creating a new tyrant instance
|
40
|
+
|
41
|
+
Each instances is separate, yet initially relative to to the tyrant manager's
|
42
|
+
home.
|
43
|
+
|
44
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager create-instance foo
|
45
|
+
00:17:55 INFO : Creating instance directory /tmp/tyrant/instances/foo
|
46
|
+
00:17:55 INFO : Creating directory /tmp/tyrant/instances/foo
|
47
|
+
00:17:55 INFO : Creating default config file /tmp/tyrant/instances/foo/config.rb
|
48
|
+
00:17:55 INFO : Creating directory /tmp/tyrant/instances/foo/ulog
|
49
|
+
00:17:55 INFO : Creating directory /tmp/tyrant/instances/foo/data
|
50
|
+
00:17:55 INFO : Creating directory /tmp/tyrant/instances/foo/lua
|
51
|
+
00:17:55 INFO : Creating directory /tmp/tyrant/instances/foo/log
|
52
|
+
|
53
|
+
This creates a new tyrant instance in the instances directory. There are
|
54
|
+
several subdirectories created for you automatically.
|
55
|
+
|
56
|
+
* data - the actual data file location
|
57
|
+
* ulog - where the update logs are kept
|
58
|
+
* log - the server logs
|
59
|
+
* lua - default location for lua code
|
60
|
+
|
61
|
+
=== Configuring an instance
|
62
|
+
|
63
|
+
Configuration of a Tyrant instances is in the 'config.rb' file in the instances
|
64
|
+
home directory. This all the configuration items that are specific to that
|
65
|
+
instance. Take a look through the file, or just execute it to see a nicely
|
66
|
+
formatted output of all the current configuration parameters, descriptions,
|
67
|
+
and current values. This example just highlights a few of the options.
|
68
|
+
|
69
|
+
jeremy@playground:/tmp/tyrant/instances/foo % ruby config.rb
|
70
|
+
The directory holding the database file. By default this is relative
|
71
|
+
to the instance directory. If you want to put it somewhere else, then
|
72
|
+
put the full path here.
|
73
|
+
- data_dir => "data"
|
74
|
+
|
75
|
+
The hostname this instance will listen on. The default is all
|
76
|
+
- host => "0.0.0.0"
|
77
|
+
|
78
|
+
[...]
|
79
|
+
|
80
|
+
Mode of the server in relation to the database. It can be a combination of
|
81
|
+
the following:
|
82
|
+
w - it is a database writer
|
83
|
+
r - it is a database reader
|
84
|
+
c - it creates the database if it does not exist
|
85
|
+
t - it truncates the database if it does exist
|
86
|
+
e - do not lock the database when doing operations
|
87
|
+
f - use a non-blocking lock when doing operations
|
88
|
+
- mode => "wc"
|
89
|
+
|
90
|
+
The options for data stored in the database. They include one of the
|
91
|
+
compression options:
|
92
|
+
d - Deflate
|
93
|
+
b - BZIP2
|
94
|
+
t - TCBS
|
95
|
+
and
|
96
|
+
l - allow the database to be larger than 2GB
|
97
|
+
- opts => "ld"
|
98
|
+
|
99
|
+
[...]
|
100
|
+
|
101
|
+
The type of database this instance will be. Options are:
|
102
|
+
memory-hash - an in memory hash database
|
103
|
+
memory-tree - an in memory B+ tree database
|
104
|
+
hash - an on disk hash database
|
105
|
+
tree - an on disk B+ tree database
|
106
|
+
fixed - an on disk fixed length database
|
107
|
+
table - an on disk table database
|
108
|
+
- type => "hash"
|
109
|
+
|
110
|
+
There are also configuration items in the 'config.rb' in the Manager's home
|
111
|
+
directory. These are global defaults for all instances the manager knows about,
|
112
|
+
and may be overridden in the instance's 'config.rb' file. Again, just execute
|
113
|
+
the configuration file to see all the options, their current set values and
|
114
|
+
the documentation.
|
115
|
+
|
116
|
+
jeremy@playground:/tmp/tyrant % ruby config.rb
|
117
|
+
The top directory of the manager directory. This is set with the
|
118
|
+
--directory option or it can be set here"
|
119
|
+
- home => nil
|
120
|
+
|
121
|
+
Default settings for tyrant instances. If a tyrant does not explicitly set one of
|
122
|
+
these configurations then the default listed here is used. This does not list all
|
123
|
+
of the configuration variables, only those that make sense to have defaults for.
|
124
|
+
- instance_defaults
|
125
|
+
|
126
|
+
[...]
|
127
|
+
|
128
|
+
Run daemonized
|
129
|
+
- instance_defaults.daemonize => true
|
130
|
+
|
131
|
+
[...]
|
132
|
+
|
133
|
+
The list of locations that contain Tyrant instances. Each element in this array
|
134
|
+
either a directory containing instance directories, or an instance directory itself.
|
135
|
+
Tyrant Manager will figure out what the case is. If this is unset, then the default
|
136
|
+
'instances' directory below the manager's home directory is used.
|
137
|
+
- instances => nil
|
138
|
+
|
139
|
+
The 'ttserver' command. This will use the first one found in path by default
|
140
|
+
or you may explicitly set it here.
|
141
|
+
- ttserver => "ttserver"
|
142
|
+
|
143
|
+
There are a considerable number of configuration options for Tokyo Tyrant and I've done
|
144
|
+
my best to document all of them.
|
145
|
+
|
146
|
+
If you do have more than one instance on a single machine, you'll need to make sure
|
147
|
+
to change the port option, otherwise only one instance will run.
|
148
|
+
|
149
|
+
desc "The port this tyrant will listen on. The default is 1978"
|
150
|
+
port 1978
|
151
|
+
|
152
|
+
=== Listing, Controlling instances and Seeing their status
|
153
|
+
|
154
|
+
Instances may be started and stopped all at once, or individually. On startup,
|
155
|
+
the ttserver command line that was used is output.
|
156
|
+
|
157
|
+
==== List known instances
|
158
|
+
|
159
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager list
|
160
|
+
bar : port 1979 : /tmp/tyrant/instances/bar
|
161
|
+
baz : port 1980 : /tmp/tyrant/instances/baz
|
162
|
+
foo : port 1978 : /tmp/tyrant/instances/foo
|
163
|
+
|
164
|
+
==== Start all
|
165
|
+
|
166
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager start
|
167
|
+
00:51:15 INFO : Starting bar : ttserver -host 0.0.0.0 -port 1979 -thnum 8 -tout 15 -dmn -pid /tmp/tyrant/instances/bar/bar.pid -log /tmp/tyrant/instances/bar/log/bar.log -le -ulog /tmp/tyrant/instances/bar/ulog -ulim 1g -rts /tmp/tyrant/instances/bar/bar.rts /tmp/tyrant/instances/bar/data/bar.tch#opts=ld#mode=wc
|
168
|
+
00:51:15 INFO :
|
169
|
+
00:51:15 INFO : Starting baz : ttserver -host 0.0.0.0 -port 1980 -thnum 8 -tout 15 -dmn -pid /tmp/tyrant/instances/baz/baz.pid -log /tmp/tyrant/instances/baz/log/baz.log -le -ulog /tmp/tyrant/instances/baz/ulog -ulim 1g -rts /tmp/tyrant/instances/baz/baz.rts /tmp/tyrant/instances/baz/data/baz.tch#opts=ld#mode=wc
|
170
|
+
00:51:15 INFO :
|
171
|
+
00:51:15 INFO : Starting foo : ttserver -host 0.0.0.0 -port 1978 -thnum 8 -tout 15 -dmn -pid /tmp/tyrant/instances/foo/foo.pid -log /tmp/tyrant/instances/foo/log/foo.log -le -ulog /tmp/tyrant/instances/foo/ulog -ulim 1g -rts /tmp/tyrant/instances/foo/foo.rts /tmp/tyrant/instances/foo/data/foo.tch#opts=ld#mode=wc
|
172
|
+
00:51:15 INFO :
|
173
|
+
|
174
|
+
As you can see the commandline used to start the tyrant server is output.
|
175
|
+
|
176
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager status
|
177
|
+
00:52:17 INFO : bar is running as pid 28658
|
178
|
+
00:52:17 INFO : baz is running as pid 28670
|
179
|
+
00:52:17 INFO : foo is running as pid 28682
|
180
|
+
|
181
|
+
==== Stop all
|
182
|
+
|
183
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager stop all
|
184
|
+
00:52:40 INFO : Stopping bar : pid 28658
|
185
|
+
00:52:40 INFO : Sent signal TERM to 28658
|
186
|
+
00:52:40 INFO : Stopping baz : pid 28670
|
187
|
+
00:52:40 INFO : Sent signal TERM to 28670
|
188
|
+
00:52:40 INFO : Stopping foo : pid 28682
|
189
|
+
00:52:40 INFO : Sent signal TERM to 28682
|
190
|
+
|
191
|
+
And see that they are all done
|
192
|
+
|
193
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager status
|
194
|
+
00:53:15 INFO : bar is not running, or its pid file is gone
|
195
|
+
00:53:15 INFO : baz is not running, or its pid file is gone
|
196
|
+
00:53:15 INFO : foo is not running, or its pid file is gone
|
197
|
+
|
198
|
+
==== Start just foo and baz
|
199
|
+
|
200
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager start foo,baz
|
201
|
+
00:53:54 INFO : Starting baz : ttserver -host 0.0.0.0 -port 1980 -thnum 8 -tout 15 -dmn -pid /tmp/tyrant/instances/baz/baz.pid -log /tmp/tyrant/instances/baz/log/baz.log -le -ulog /tmp/tyrant/instances/baz/ulog -ulim 1g -rts /tmp/tyrant/instances/baz/baz.rts /tmp/tyrant/instances/baz/data/baz.tch#opts=ld#mode=wc
|
202
|
+
00:53:54 INFO :
|
203
|
+
00:53:54 INFO : Starting foo : ttserver -host 0.0.0.0 -port 1978 -thnum 8 -tout 15 -dmn -pid /tmp/tyrant/instances/foo/foo.pid -log /tmp/tyrant/instances/foo/log/foo.log -le -ulog /tmp/tyrant/instances/foo/ulog -ulim 1g -rts /tmp/tyrant/instances/foo/foo.rts /tmp/tyrant/instances/foo/data/foo.tch#opts=ld#mode=wc
|
204
|
+
00:53:54 INFO :
|
205
|
+
|
206
|
+
Foo and baz are started, bar is still stopped
|
207
|
+
|
208
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager status
|
209
|
+
00:54:38 INFO : bar is not running, or its pid file is gone
|
210
|
+
00:54:38 INFO : baz is running as pid 28708
|
211
|
+
00:54:38 INFO : foo is running as pid 28720
|
212
|
+
|
213
|
+
=== Stop just foo
|
214
|
+
|
215
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager stop foo
|
216
|
+
00:55:33 INFO : Stopping foo : pid 28720
|
217
|
+
00:55:33 INFO : Sent signal TERM to 28720
|
218
|
+
|
219
|
+
And baz is still running
|
220
|
+
|
221
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager status
|
222
|
+
00:55:51 INFO : bar is not running, or its pid file is gone
|
223
|
+
00:55:51 INFO : baz is running as pid 28708
|
224
|
+
00:55:51 INFO : foo is not running, or its pid file is gone
|
225
|
+
|
226
|
+
=== Look at the server statistics
|
227
|
+
|
228
|
+
You can also look at the server statistics of each running instance
|
229
|
+
|
230
|
+
jeremy@playground:/tmp/tyrant % tyrantmanager stats
|
231
|
+
Instance bar at /tmp/tyrant/instances/bar
|
232
|
+
bigend.... 0
|
233
|
+
fd........ 7
|
234
|
+
libver.... 312
|
235
|
+
loadavg... 0.030000
|
236
|
+
memrss.... 1003520
|
237
|
+
memsize... 173633536
|
238
|
+
os........ Linux
|
239
|
+
path...... /tmp/tyrant/instances/bar/data/bar.tch
|
240
|
+
pid....... 28749
|
241
|
+
protver... 0.91
|
242
|
+
rnum...... 0
|
243
|
+
ru_real... 14.560829
|
244
|
+
ru_sys.... 0.000000
|
245
|
+
ru_user... 0.004000
|
246
|
+
sid....... 72615862
|
247
|
+
size...... 1052992
|
248
|
+
time...... 1249174632.207222
|
249
|
+
type...... hash
|
250
|
+
version... 1.1.29
|
251
|
+
[...]
|
252
|
+
|
253
|
+
== CREDITS
|
254
|
+
|
255
|
+
* Inspired by the {Light Cloud}[http://opensource.plurk.com/LightCloud/Tyrant_manager/} tyrant manager
|
256
|
+
* {Tokyo Tyrant}[http://tokyocabinet.sourceforge.net/tyrantdoc/]
|
257
|
+
|
258
|
+
== LICENSE
|
259
|
+
|
260
|
+
Copyright (c) 2009, Jeremy Hinegardner
|
261
|
+
|
262
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
263
|
+
purpose with or without fee is hereby granted, provided that the above
|
264
|
+
copyright notice and this permission notice appear in all copies.
|
265
|
+
|
266
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
267
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
268
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
269
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
270
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
271
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
272
|
+
PERFORMANCE OF THIS SOFTWARE.
|
273
|
+
|
data/bin/tyrantmanager
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2009
|
5
|
+
# All rights reserved. See LICENSE and/or COPYING for details.
|
6
|
+
#++
|
7
|
+
|
8
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
|
9
|
+
require 'tyrant_manager'
|
10
|
+
::TyrantManager::Cli.new( ARGV, ENV ).run
|
data/data/config.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'loquacious'
|
3
|
+
|
4
|
+
Loquacious::Configuration.for( "manager" ) do
|
5
|
+
|
6
|
+
desc <<-txt
|
7
|
+
The 'ttserver' command. This will use the first one found in path by default
|
8
|
+
or you may explicitly set it here.
|
9
|
+
txt
|
10
|
+
ttserver "ttserver"
|
11
|
+
|
12
|
+
desc <<-txt
|
13
|
+
The top directory of the manager directory. This is set with the
|
14
|
+
--directory option or it can be set here"
|
15
|
+
txt
|
16
|
+
home nil
|
17
|
+
|
18
|
+
desc <<-txt
|
19
|
+
The list of locations that contain Tyrant instances. Each element in this array
|
20
|
+
either a directory containing instance directories, or an instance directory itself.
|
21
|
+
Tyrant Manager will figure out what the case is. If this is unset, then the default
|
22
|
+
'instances' directory below the manager's home directory is used.
|
23
|
+
txt
|
24
|
+
instances nil
|
25
|
+
|
26
|
+
desc <<-txt
|
27
|
+
Default settings for tyrant instances. If a tyrant does not explicitly set one of
|
28
|
+
these configurations then the default listed here is used. This does not list all
|
29
|
+
of the configuration variables, only those that make sense to have defaults for.
|
30
|
+
txt
|
31
|
+
instance_defaults {
|
32
|
+
desc "The number of threads to use"
|
33
|
+
thread_count 8
|
34
|
+
|
35
|
+
desc "Number of seconds to terminate a session request if no request is made"
|
36
|
+
session_timeout 15
|
37
|
+
|
38
|
+
desc "The level of logging, this can be 'debug', 'info', or 'error'"
|
39
|
+
log_level "error"
|
40
|
+
|
41
|
+
desc "Run daemonized"
|
42
|
+
daemonize true
|
43
|
+
|
44
|
+
desc <<-txt
|
45
|
+
The size of the update log in bytes. You may use a trailing letter to indicate
|
46
|
+
kilobytes(k), megabytes(m), gigabytes(g), terabytes(t), exabytes(e)
|
47
|
+
txt
|
48
|
+
update_log_size "1g"
|
49
|
+
|
50
|
+
desc "Use asychronous I/O when writing to the update log"
|
51
|
+
update_log_async false
|
52
|
+
|
53
|
+
desc <<-txt
|
54
|
+
Forbidden protocol commands, this is the list of commands that will be denied to the client.
|
55
|
+
The full list is:
|
56
|
+
| put putkeep putcat putshl putnr out get mget vsize iterinit iternext fwmkeys addint
|
57
|
+
| adddouble ext sync optimize vanish copy restore setmst rnum size stat misc repl slave
|
58
|
+
|
59
|
+
There are meta lists too:
|
60
|
+
|
61
|
+
| all : all commands
|
62
|
+
| allorg : all tyrant binary protocol commands
|
63
|
+
| allmc : all memecached protocol commands
|
64
|
+
| allhttp : all http commands
|
65
|
+
| allread : get mget vsiz iterinit iternext fwmkeys rnum size stat
|
66
|
+
| allwrite : put putkeep putcat putshl putnr out addint adddouble vanish misc
|
67
|
+
| allmanage : sync optimize copy restore setmst
|
68
|
+
|
69
|
+
To deny optimize vanish and slave commands the configuration would be:
|
70
|
+
|
71
|
+
| deny_commands [ 'vanish', 'slave', 'optimizie' ]
|
72
|
+
|
73
|
+
txt
|
74
|
+
deny_commands nil
|
75
|
+
|
76
|
+
desc <<-txt
|
77
|
+
Specifically allowed protocol commands. This will only allow these commands. The same
|
78
|
+
list of commands in the deny_commands configuration is available.
|
79
|
+
|
80
|
+
Leave this as nil to use the defaults. To only allow the read and write commands and no
|
81
|
+
others the configuration would be:
|
82
|
+
|
83
|
+
| allow_commands [ 'allread', 'allwrite' ]
|
84
|
+
|
85
|
+
txt
|
86
|
+
allow_commands nil
|
87
|
+
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
if $0 == __FILE__ then
|
92
|
+
help = Loquacious::Configuration.help_for("manager", :colorize => true)
|
93
|
+
help.show( :values => true )
|
94
|
+
end
|
@@ -0,0 +1,244 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'loquacious'
|
3
|
+
|
4
|
+
#
|
5
|
+
# The configuration for the <%= instance_name %> tokyo tyrant instance
|
6
|
+
#
|
7
|
+
# The options available in the instance_defaults section of the manager
|
8
|
+
# configuration are also able to be set here.
|
9
|
+
#
|
10
|
+
Loquacious::Configuration.for( "<%= instance_name %>" ) do
|
11
|
+
|
12
|
+
desc "The hostname this instance will listen on. The default is all"
|
13
|
+
host "0.0.0.0"
|
14
|
+
|
15
|
+
desc "The port this tyrant will listen on. The default is 1978"
|
16
|
+
port 1978
|
17
|
+
|
18
|
+
desc <<-txt
|
19
|
+
The type of database this instance will be. Options are:
|
20
|
+
| memory-hash - an in memory hash database
|
21
|
+
| memory-tree - an in memory B+ tree database
|
22
|
+
| hash - an on disk hash database
|
23
|
+
| tree - an on disk B+ tree database
|
24
|
+
| fixed - an on disk fixed length database
|
25
|
+
| table - an on disk table database
|
26
|
+
txt
|
27
|
+
type "hash"
|
28
|
+
|
29
|
+
desc <<-txt
|
30
|
+
Mode of the server in relation to the database. It can be a combination of
|
31
|
+
the following:
|
32
|
+
| w - it is a database writer
|
33
|
+
| r - it is a database reader
|
34
|
+
| c - it creates the database if it does not exist
|
35
|
+
| t - it truncates the database if it does exist
|
36
|
+
| e - do not lock the database when doing operations
|
37
|
+
| f - use a non-blocking lock when doing operations
|
38
|
+
txt
|
39
|
+
mode "wc"
|
40
|
+
|
41
|
+
|
42
|
+
desc <<-txt
|
43
|
+
The options for data stored in the database. They include one of the
|
44
|
+
compression options:
|
45
|
+
| d - Deflate
|
46
|
+
| b - BZIP2
|
47
|
+
| t - TCBS
|
48
|
+
and
|
49
|
+
| l - allow the database to be larger than 2GB
|
50
|
+
txt
|
51
|
+
opts "ld"
|
52
|
+
|
53
|
+
desc <<-txt
|
54
|
+
Tuning parameters. Each of these alters a tuning parameter on the database.
|
55
|
+
Not all of them are applicable to all database types
|
56
|
+
txt
|
57
|
+
|
58
|
+
tuning_params {
|
59
|
+
desc <<-txt
|
60
|
+
The number of elements in the bucket array. Supported in hash, B+ tree
|
61
|
+
and table databases. It is also used in the in-memory hash database.
|
62
|
+
It should be between 1 and 4 times the number of all records to be stored.
|
63
|
+
txt
|
64
|
+
bnum nil
|
65
|
+
|
66
|
+
desc <<-txt
|
67
|
+
The maximum number of records to store in the database. This is only
|
68
|
+
used in the in-memory databases.
|
69
|
+
txt
|
70
|
+
capnum nil
|
71
|
+
|
72
|
+
desc <<-txt
|
73
|
+
The maximum amount of memory to use in the server. This is only used
|
74
|
+
in the in-memory databases.
|
75
|
+
txt
|
76
|
+
capsize nil
|
77
|
+
|
78
|
+
desc <<-txt
|
79
|
+
Aligment power. The byte alignment of records. This specifies a power
|
80
|
+
of two. The default value is 4 meaning that all records are aligned on
|
81
|
+
16 byte boundaries.
|
82
|
+
|
83
|
+
This applies to on disk Hash, B+ tree and Table databases.
|
84
|
+
txt
|
85
|
+
apow nil
|
86
|
+
|
87
|
+
desc <<-txt
|
88
|
+
Free block pool power. This is the maximum number of elements in the free
|
89
|
+
block pool as a power of 2. The default is 10 meaning that there are a
|
90
|
+
maximum of 1024 free blocks.
|
91
|
+
|
92
|
+
This applies to on disk hash, B+ tree and Table databases.
|
93
|
+
txt
|
94
|
+
fpow nil
|
95
|
+
|
96
|
+
desc <<-txt
|
97
|
+
The maximum number of records to be cached. If set to 0 or less then
|
98
|
+
the cache is disabled. That is the default.
|
99
|
+
|
100
|
+
This applies to on disk Hash and Table databases.
|
101
|
+
txt
|
102
|
+
rcnum nil
|
103
|
+
|
104
|
+
desc <<-txt
|
105
|
+
The size of the memory mapped region. By default this is 64 megabytes.
|
106
|
+
|
107
|
+
This applies to on disk Hash, B+ tree and Table databases.
|
108
|
+
txt
|
109
|
+
xmsiz
|
110
|
+
|
111
|
+
desc <<-txt
|
112
|
+
Auto defragmentation configuration. This controls how the automatic
|
113
|
+
defragmentation of databases is preformed. It is the 'step'
|
114
|
+
number. It is off by default.
|
115
|
+
|
116
|
+
This applies to on disk Hash, B+ tree and Table databases.
|
117
|
+
txt
|
118
|
+
dfunit nil
|
119
|
+
|
120
|
+
desc <<-txt
|
121
|
+
The maximum number of leaf nodes to be cached. The default is 4096.
|
122
|
+
|
123
|
+
This applies to B+ tree and Table databses
|
124
|
+
txt
|
125
|
+
lcnum nil
|
126
|
+
|
127
|
+
desc <<-txt
|
128
|
+
The maximum number of non-leaf nodes to be cached. The default is 512.
|
129
|
+
|
130
|
+
This applies to B+ tree and Table databses
|
131
|
+
txt
|
132
|
+
ncnum nil
|
133
|
+
|
134
|
+
desc <<-txt
|
135
|
+
The number of members in each leaf page. The default is 128.
|
136
|
+
|
137
|
+
This applies to B+ tree databases.
|
138
|
+
txt
|
139
|
+
lmemb nil
|
140
|
+
|
141
|
+
desc <<-txt
|
142
|
+
The number of members in each non-leaf page. The default is 128.
|
143
|
+
|
144
|
+
This applies to B+ tree databases.
|
145
|
+
txt
|
146
|
+
nmemb nil
|
147
|
+
|
148
|
+
desc <<-txt
|
149
|
+
The width of the value of each record in a fixed length database.
|
150
|
+
The default is 255.
|
151
|
+
txt
|
152
|
+
width nil
|
153
|
+
|
154
|
+
desc <<-txt
|
155
|
+
The file size limit of the fixed database file. The default is 256 MB.
|
156
|
+
txt
|
157
|
+
limsiz nil
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
desc <<-txt
|
162
|
+
The directory holding the database file. By default this is relative
|
163
|
+
to the instance directory. If you want to put it somewhere else, then
|
164
|
+
put the full path here.
|
165
|
+
txt
|
166
|
+
data_dir "data"
|
167
|
+
|
168
|
+
desc <<-txt
|
169
|
+
The directory holding the update logs. By default this is relative
|
170
|
+
to the instance directory. If you want to put it somewhere else, then
|
171
|
+
put the full path here.
|
172
|
+
txt
|
173
|
+
ulog_dir "ulog"
|
174
|
+
|
175
|
+
|
176
|
+
desc <<-txt
|
177
|
+
The pid file location. By default this is relative to the instance
|
178
|
+
directory. If you want it place somewhere else, then put the full
|
179
|
+
path here.
|
180
|
+
txt
|
181
|
+
pid_file "<%= instance_name %>.pid"
|
182
|
+
|
183
|
+
|
184
|
+
desc <<-txt
|
185
|
+
The log file location. By default this is relative to the instance
|
186
|
+
directory. If you want it place somewhere else, then put the full
|
187
|
+
path here.
|
188
|
+
txt
|
189
|
+
log_file "log/<%= instance_name %>.log"
|
190
|
+
|
191
|
+
|
192
|
+
desc <<-txt
|
193
|
+
If this instance is to replicate the data from another instance then
|
194
|
+
set that instances host here.
|
195
|
+
txt
|
196
|
+
master_server nil
|
197
|
+
|
198
|
+
desc <<-txt
|
199
|
+
If this instance is to replicate the data from another instance then
|
200
|
+
set that instances port here.
|
201
|
+
txt
|
202
|
+
master_port nil
|
203
|
+
|
204
|
+
desc <<-txt
|
205
|
+
This is the server id of this instance when it is part of a replication.
|
206
|
+
This must be set, and it must be unique within the set of hosts doing
|
207
|
+
replication.
|
208
|
+
txt
|
209
|
+
server_id nil
|
210
|
+
|
211
|
+
desc <<-txt
|
212
|
+
If this server is replicating data from a master, then it must have
|
213
|
+
this set to the location of a replication timestamp file. The
|
214
|
+
default is relative to the instance directory.
|
215
|
+
txt
|
216
|
+
replication_timestamp_file "<%= instance_name %>.rts"
|
217
|
+
|
218
|
+
desc <<-txt
|
219
|
+
The name of a file to load as a lua extension. By default this
|
220
|
+
is relative to the root of the instance directory. This file will
|
221
|
+
only be loaded if it exists.
|
222
|
+
txt
|
223
|
+
lua_extension_file "lua/<%= instance_name %>.lua"
|
224
|
+
|
225
|
+
desc <<-txt
|
226
|
+
You may specify a lua function and a periodicity in which it is to
|
227
|
+
be called. This lua function must be available from within the
|
228
|
+
lua_extension_file that is loaded.
|
229
|
+
|
230
|
+
The periodicity is really the time to wait between calls.
|
231
|
+
txt
|
232
|
+
periodic_command {
|
233
|
+
desc "The function to call"
|
234
|
+
name nil
|
235
|
+
|
236
|
+
desc "how often to call"
|
237
|
+
period nil
|
238
|
+
}
|
239
|
+
end
|
240
|
+
|
241
|
+
if $0 == __FILE__ then
|
242
|
+
help = Loquacious::Configuration.help_for("<%= instance_name %>", :colorize => true)
|
243
|
+
help.show :values => true
|
244
|
+
end
|