-
Notifications
You must be signed in to change notification settings - Fork 558
/
Copy pathcomet-example.conf
245 lines (210 loc) · 7.83 KB
/
comet-example.conf
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
# Comet configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1kb => 1024 bytes
# 1mb => 1024*1024 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.
# Note on units: when time duration is needed, it is possible to specify
# it in the usual form of 1s 5M 4h and so forth:
#
# 1s => 1000 * 1000 * 1000 nanoseconds
# 1m => 60 seconds
# 1h => 60 minutes
#
# units are case insensitive so 1h 1H are all the same.
[base]
# If the master process is run as root, then comet will setuid()/setgid()
# to USER/GROUP. If GROUP is not specified, then comet uses the same name as
# USER. By default it's nobody user and nobody or nogroup group.
user nobody
# When running daemonized, Comet writes a pid file in
# /tmp/gopush-cluster-comet.pid by default. You can specify a custom pid file
# location here.
pidfile /tmp/gopush-cluster-comet.pid
# Sets the maximum number of CPUs that can be executing simultaneously.
# This call will go away when the scheduler improves. By default the number of
# logical CPUs is set.
#
# maxproc 4
# By default comet listens for connections from all the network interfaces
# available on the server on 6968 port. It is possible to listen to just one or
# multiple interfaces using the "websocket.bind" configuration directive,
# followed by one or more IP addresses and port.
#
# Examples:
#
# Note this directive is only support "websocket" protocol
# websocket.bind 192.168.1.100:6968,10.0.0.1:7068
# websocket.bind 127.0.0.1:6968
# websocket.bind 0.0.0.0:6968
websocket.bind localhost:6968,localhost:7068
# By default comet listens for connections from all the network interfaces
# available on the server on 6969 port. It is possible to listen to just one or
# multiple interfaces using the "tcp.bind" configuration directive, followed by
# one or more IP addresses and port.
#
# Examples:
#
# Note this directive is only support "tcp" protocol
# tcp.bind 192.168.1.100:6969,10.0.0.1:7069
# tcp.bind 127.0.0.1:6969
# tcp.bind 0.0.0.0:6969
tcp.bind localhost:6969,localhost:7069
# This is used by rpc listen for internal protocol.
# By default comet admin listens for connections from local interfaces on 6970
# port. It's not safty for listening internet IP addresses.
#
# Examples:
#
# rpc.bind 192.168.1.100:6970,10.0.0.1:7070
# rpc.bind 127.0.0.1:6970
# rpc.bind 0.0.0.0:6970
rpc.bind localhost:6970,localhost:7070
# This is used by comet service profiling (pprof).
# By default comet pprof listens for connections from local interfaces on 6971
# port. It's not safty for listening internet IP addresses.
#
# Examples:
#
# pprof.bind 192.168.1.100:6971,10.0.0.1:6971
# pprof.bind 127.0.0.1:6971
# pprof.bind 0.0.0.0:6971
pprof.bind localhost:6971
# This is used by comet service get stat info by http.
# By default comet pprof listens for connections from local interfaces on 6972
# port. It's not safty for listening internet IP addresses.
#
# Examples:
#
# stat.bind 192.168.1.100:6971,10.0.0.1:6971
# stat.bind 127.0.0.1:6971
# stat.bind 0.0.0.0:6971
stat.bind localhost:6972
# The working directory.
#
# The log will be written inside this directory, with the filename specified
# above using the 'logfile' configuration directive.
#
# Note that you must specify a directory here, not a file name.
dir ./
# Log4go configuration xml path.
#
# Examples:
#
# log /gopush/log.xml
log /data/apps/go/bin/comet_log.xml
################################## ZOOKEEPER ##################################
# The zookeeper cluster section. When comet start, it will register data in the
# zookeeper cluster and create a ephemeral node. When comet died, the node will
# drop by zookeeper cluster. So we can use the feature implement node failover.
[zookeeper]
# Comet create ephemeral node at the specified root path.
#
# Note the path must start with "/".
comet.path /gopush-cluster-comet
# Set the node name of comet in zookeeper cluster. The default node name is
# node1, you must ensure the unique node name in the gopush cluster.
# Or you can make the same node name comet instance a slave of working one.
comet.node node1
# Set the node weight, must greate than zero.
#
# Examples:
#
# comet.weight 1
comet.weight 1
# Comet get message rpc info from message path
#
# Note the path must start with "/".
message.path /gopush-cluster-message
# Zookeeper cluster addresses. Mutiple address split by a ",".
# Examples:
#
# addr 192.168.1.100:2181,10.0.0.1:2181
# addr 127.0.0.1:2181
addr localhost:2181
# Zookeeper cluster session idle timeout seconds. Zookeeper will close the
# connection after a client is idle for N seconds.
# Examples:
#
# timeout 30s
# timeout 15s
timeout 30s
################################## RPC ########################################
[rpc]
# Comet do a ping RPC call to test the rpc host available every N seconds.
ping 1s
# If rpc host down, comet will retry connect to rpc host every N seconds.
retry 1s
################################## CHANNELS ###################################
[channel]
# SO_SNDBUF and SO_RCVBUF are options to adjust the normal buffer sizes
# allocated for output and input buffers, respectively. The buffer size may
# be increased for high-volume connections, or may be decreased to limit the
# possible backlog of incoming data. The system places an absolute limit on
# these values.
#
# Sets the maximum socket send buffer in bytes. The kernel doubles
# this value (to allow space for bookkeeping overhead) when it is set using
# setsockopt(2). The default value is set by the
# /proc/sys/net/core/wmem_default file and the maximum allowed value is set by
# the /proc/sys/net/core/wmem_max file. The minimum (doubled) value for this
# option is 2048.
sndbuf.size 2048
# Sets the maximum socket receive buffer in bytes. The kernel doubles this
# value (to allow space for bookkeeping overhead) when it is set using
# setsockopt(2). The default value is set by the
# /proc/sys/net/core/rmem_default file, and the maximum allowed value is set by
# the /proc/sys/net/core/rmem_max file. The minimum (doubled) value
# for this option is 256.
rcvbuf.size 256
# Comet support "tcp" and "websocket" push protocol.
#
# Examples
# proto tcp
# proto tcp,websocket
proto tcp,websocket
# bufio.Reader cache instance for tcp cmd parsing, suggest the CPUs number.
#
# Note this directive is only support "tcp" protocol
# bufio.instance 4
# bufio.Reader cache number every instance.
#
# Note this directive is only support "tcp" protocol
bufio.num 128
# TCP keepalive.
#
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful for two reasons:
#
# 1) Detect dead peers.
# 2) Take the connection alive from the point of view of network
# equipment in the middle.
#
# On Linux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection the double of the time is needed.
# On other kernels the period depends on the kernel configuration.
#
# A reasonable value for this option is 60 seconds.
tcp.keepalive no
# Max subscribers per channel. The same key subscribers limit by it.
maxsubscriber 64
# Every user per channel, For performance reason, Comet split channels into
# N buckets. Suggest the CPUs number.
# bucket 16
# Comet need auth or not, if yes client must send a token to the comet to verify
# that has rights to access comet service.
auth no
# Message buffer cache num, if exceed this value, the comet will close the
# connection.
msgbuf.num 120
################################## INCLUDES ###################################
# Include one or more other config files here. This is useful if you
# have a standard template that goes to all comet server but also need
# to customize a few per-server settings. Include files can include
# other files, so use this wisely.
#
# include /path/to/local.conf
# include /path/to/other.conf