Skip to content

pomelo cli man page

shudingbo edited this page Feb 26, 2020 · 15 revisions

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  

addCron

add cron for server' addCron args are key=value from crons.json config files

example: addCron id=8 serverId=chat-server-1 'time=0 30 10 * * *' action=chatCron.send
example: addCron id=8 serverType=chat 'time=0 30 10 * * *' action=chatCron.send

removeCron

remove cron for server',

example: removeCron id=8 serverId=chat-server-1
example: removeCron id=8 serverType=chat

blacklist

add blacklist for frontend server

example: blacklist 192.168.10.120 192.168.18.60
example: blacklist \b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b

run

run script in server

example: run app.get("sessionService").getSessionsCount()
example: run app.isMaster()

execStr

execStr script string

example: execStr "var cpus = os.cpus();result = util.inspect(cpus,true,null);"

systemInfo

get systemInfo

example: systemInfo

nodeInfo

get nodeInfo

example: nodeInfo

monitorLog

get monitor Log

example: monitorLog <logfile prefix> <get line number>
example: monitorLog pomelo 100