pomelo cli man page

fantasyni edited this page Sep 12, 2013 · 11 revisions
Clone this wiki locally

Commands list

Use

use another server. takes serverId|all as argument
use {serverId|all}
then you will switch to serverId|all context
your command will be applied to serverId|all server

example: use area-server-1  
example: use all  

note: context is what your command will be applied to

Quit

type quit and you can quit pomelo-cli

Kill

kill all servers

example: **kill**  

note: be carefull to use this command

Exec

exec script files
exec {filepath}
filepath can be relative path to your pomelo-cli pwd path

example : exec xxx.js  

equals to : exec pwd/xxx.js
filepath also can be absolute with '/' ahead

example : exec /home/user/xxx.js  

script file is executed through vm
vm context is

var context = {
  app: this.app,
  require: require,
  os: require("os"),
  fs: require("fs"),
  process: process,
  util: util
};

execute result is returned through result param
so in script files you should use result to get the return value

getCPUs.js

var cpus = os.cpus();
result = util.inspect(cpus,true,null);

Get

equal to app.get(key)
get {key}

Set

equal to app.set(key, value)
set {key} {value}

note: value must be string or simple value

Add

add server to pomelo clusters
add args are key=value from servers.json config files

example: add host=127.0.0.1 port=3451 serverType=chat id=chat-server-2  
example: add host=127.0.0.1 port=3152 serverType=connector id=connector-server-3 clientPort=3012 frontend=true  

note: be careful to add server using right full args, otherwise the server will run in bad mode

Stop

stop server. takes serverId as argument
stop {serverId}

example: stop area-server-1  

Show

show infos like : servers, connections
you can show following informations:
servers, connections, logins, modules, status, proxy, handler, components, settings

example: show servers  
example: show connections  
example: show proxy  
example: show handler  
example: show logins  

Enable

enable an admin console module or enable app settings
enable module {moduleId}
enable app {settings}

example: enable module systemInfo  
example: enable app systemMonitor  

Disable

disable an admin console module or disable app settings
disable module {moduleId}
disable app {settings}

example: disable module systemInfo  
example: disable app systemMonitor  

Dump

make a dump of the V8 heap and cpu for later inspection
dump cpu|memory {filepath} [times] [--force]
times is the number of cpu dump costs in seconds

example: dump cpu /home/xxx/test 5  
example: dump memory /home/xxx/test  

note: you can add --force to write dump file if file existed

example: dump cpu /home/xxx/test 5 --force  
example: dump memory /home/xxx/test --force  

Inspecting the snapshot

Open Google Chrome and press F12 to open the developer toolbar.

Go to the Profiles tab, right-click in the tab pane and select Load profile....

Select the dump file and click Open. You can now inspect the heap snapshot at your leisure.

for more infos about dump you can visit ndump