Skip to content

Commit b0542d8

Browse files
committed
Manage Tyrant processes using tyrantmanager.
The tool is found at http://copiousfreetime.rubyforge.org/tyrantmanager/ Added configuration files with a complete directory structure in db/tyrant. Had to add empty .gitignore files in order to trick git to include "empty" directories.
1 parent 5807fa0 commit b0542d8

File tree

19 files changed

+830
-3
lines changed

19 files changed

+830
-3
lines changed

.gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
.*.swp
1+
*.log
2+
*.pid
3+
*.swp
4+
*.tct
25
config/config.yml
36
config/database.yml
4-
db/*.tct
5-
log/*.log
67
log/*.log.*
78
public/system/*
89
tmp/pids/*

db/tyrant/config.rb

+94
Original file line numberDiff line numberDiff line change
@@ -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
+244
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
require 'rubygems'
2+
require 'loquacious'
3+
4+
#
5+
# The configuration for the highlights 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( "highlights" ) 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 19870
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 "table"
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 40
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 "highlights.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/highlights.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 "highlights.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/highlights.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("highlights", :colorize => true)
243+
help.show :values => true
244+
end

db/tyrant/instances/highlights/data/.gitignore

Whitespace-only changes.

db/tyrant/instances/highlights/log/.gitignore

Whitespace-only changes.

db/tyrant/instances/highlights/lua/.gitignore

Whitespace-only changes.

db/tyrant/instances/highlights/ulog/.gitignore

Whitespace-only changes.

0 commit comments

Comments
 (0)